添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

I try compile Bitcoin lightningnetwork library with depended code. I have error: “lnrpc\rpc.pb.go:93:8: no buildable Go source files in d:\code\go\src\github.com\grpc-ecosystem\grpc-gateway\third_party\googleapis\google\api” m there are files: annotations.proto and http.proto,
annotations.proto begin with:

syntax = “proto3”;
package google.api;
import “google/api/http.proto”;
import “google/protobuf/descriptor.proto”;

I have downloaded file protoc.exe. But when I try >protoc --go_out=. *.proto I have errors:
google/api/http.proto: File not found.
google/protobuf/descriptor.proto: File not found.
annotations.proto: Import “google/api/http.proto” was not found or had errors.
annotations.proto: Import “google/protobuf/descriptor.proto” was not found or had errors.
annotations.proto:28:8: “google.protobuf.MethodOptions” is not defined.

http.proto is in current directory, no file descriptor.proto

I think you should file a bug on the repository, as they should include the generated serialization code in the package so you don’t have to compile the protobuf files yourself.

Doing so is surprisingly messy (in getting the various include paths right) so I’m not able to give you any specific advice.

Then, go get -u as usual the following packages:

go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
go get -u github.com/golang/protobuf/protoc-gen-go

I try compiling on Windows, download protoc.exe and do "go get -u " without errors but still are problems with *.proto, I issued.

If you are on Windows, rather download the protoc binary instead of trying to build the binary from source.

The latest protoc Windows binary: Click to download

Or visit the Release page

Remember to add the folder where protoc binary is to your %PATH%

Make sure you include the path of the third party library/annotations you are referencing

For example:

protoc -I/usr/local/include -I. \ -I$GOPATH/src \ -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ --go_out=plugins=grpc:. \ path/to/your_service.proto

Also, have a look at the steps on the grpc-gateway page (Step 3 +4) :