Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot find package "google/api" #67

Closed
tmc opened this issue Dec 1, 2015 · 0 comments
Closed

cannot find package "google/api" #67

tmc opened this issue Dec 1, 2015 · 0 comments

Comments

@tmc
Copy link
Collaborator

tmc commented Dec 1, 2015

Upstream protobuf package changed and the generated code now fails:

~/go/src/github.com/gengo/grpc-gateway(master)$ git pull
Current branch master is up to date.
⚛ ~/go/src/github.com/gengo/grpc-gateway(master)$ git clean -xdf .~/go/src/github.com/gengo/grpc-gateway(master)$ make examples
go get github.com/golang/protobuf/protoc-gen-go
go build -o bin/protoc-gen-go github.com/golang/protobuf/protoc-gen-go
protoc -I /usr/local/bin//../include -I. -Ithird_party/googleapis --plugin=bin/protoc-gen-go --go_out=Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor,Mexamples/sub/message.proto=github.com/gengo/grpc-gateway/examples/sub,plugins=grpc:. examples/examplepb/echo_service.proto examples/examplepb/a_bit_of_everything.proto examples/examplepb/flow_combination.proto
protoc -I /usr/local/bin//../include  -Ithird_party/googleapis --plugin=bin/protoc-gen-go --go_out=Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor,Mexamples/sub/message.proto=github.com/gengo/grpc-gateway/examples/sub:third_party/googleapis third_party/googleapis/google/api/annotations.proto third_party/googleapis/google/api/http.proto
go build -o bin/protoc-gen-grpc-gateway github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway
protoc -I /usr/local/bin//../include -I. -Ithird_party/googleapis --plugin=bin/protoc-gen-grpc-gateway --grpc-gateway_out=logtostderr=true,Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor,Mexamples/sub/message.proto=github.com/gengo/grpc-gateway/examples/sub:. examples/examplepb/echo_service.proto examples/examplepb/a_bit_of_everything.proto examples/examplepb/flow_combination.proto
protoc -I /usr/local/bin//../include -I. --plugin=bin/protoc-gen-go --go_out=Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor,Mexamples/sub/message.proto=github.com/gengo/grpc-gateway/examples/sub,plugins=grpc:. examples/sub/message.proto
⚛ ~/go/src/github.com/gengo/grpc-gateway(master)$ go build ./...
examples/examplepb/a_bit_of_everything.pb.go:10:8: cannot find package "google/api" in any of:
    /usr/local/Cellar/go/1.5.1/libexec/src/google/api (from $GOROOT)
    /Users/tmc/go/src/google/api (from $GOPATH)
yugui added a commit that referenced this issue Dec 9, 2015
Fixes #67.

protoc-gen-go started to keep unused imports of .proto files.
So we need to map google/api/annotation.proto to a valid golang import path.

Another possible solution was to map the proto file to some harmless package,
e.g. "fmt".  But it would be safer to map it to a valid path.
yugui added a commit that referenced this issue Dec 10, 2015
Fixes #67.

protoc-gen-go started to keep unused imports of .proto files.
So we need to map google/api/annotation.proto to a valid golang import path.

Another possible solution was to map the proto file to some harmless package,
e.g. "fmt".  But it would be safer to map it to a valid path.
@yugui yugui closed this as completed in #71 Dec 10, 2015
ithinker1991 pushed a commit to tronprotocol/grpc-gateway that referenced this issue Jun 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant