You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to use gRPC Gateway, because it looks incredibly awesome, but I encountered the following problem and I haven't been able to solve it so far:
When trying to use Google's http annotations, the generated pb.go file looks a bit strange. It includes the following:
import _ "google/api"
I have to admit that I don't use protoc as it is described in the README, but I think it should work this way too. Furthermore, I've tried every combination of import paths, none of them worked.
I use multiple paths in my GOPATH variable: there is one for package installations (the first) and the other where my code lives. Something like this: $HOME/.go:$HOME/Projects/go
Also, my protoc binary is copied to my own binary prefix. I know that it might not found certain files that way, but I provide an import path for the protobuf protos.
I use Glide for vendoring.
So my actual command is: protoc -I ${PROTO_PATH} -I vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis -I vendor/github.com/google/protobuf/src ${PROTO_PATH}/iam/user/v1alpha1/login.proto --go_out=plugins=grpc:apis
As you can see, I add googleapis and protobuf as import path (besides the one where my actual proto file lives).
I would like to use gRPC Gateway, because it looks incredibly awesome, but I encountered the following problem and I haven't been able to solve it so far:
When trying to use Google's http annotations, the generated pb.go file looks a bit strange. It includes the following:
import _ "google/api"
I have to admit that I don't use protoc as it is described in the README, but I think it should work this way too. Furthermore, I've tried every combination of import paths, none of them worked.
I use multiple paths in my
GOPATH
variable: there is one for package installations (the first) and the other where my code lives. Something like this:$HOME/.go:$HOME/Projects/go
Also, my
protoc
binary is copied to my own binary prefix. I know that it might not found certain files that way, but I provide an import path for the protobuf protos.I use Glide for vendoring.
So my actual command is:
protoc -I ${PROTO_PATH} -I vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis -I vendor/github.com/google/protobuf/src ${PROTO_PATH}/iam/user/v1alpha1/login.proto --go_out=plugins=grpc:apis
As you can see, I add googleapis and protobuf as import path (besides the one where my actual proto file lives).
My proto looks like this:
I believe it should work this way, but it generates a file with the above import. Looking at the examples in this repository I see imports like this:
import _ "google.golang.org/genproto/googleapis/api/annotations"
I'm a little bit confused, because I don't understand how the go protoc plugin guesses where it should look for the generated file of a proto.
Any help would be appreciated, thank you very much in advance.
The text was updated successfully, but these errors were encountered: