Skip to content
New issue

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

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

Already on GitHub? # to your account

Move to google.golang.org/genproto instead of shipping annotations.proto. #202

Closed
tmc opened this issue Jul 25, 2016 · 6 comments
Closed

Comments

@tmc
Copy link
Collaborator

tmc commented Jul 25, 2016

for motivation: googleapis/gapic-generator#324

@yugui
Copy link
Member

yugui commented Jul 26, 2016

@tmc Does it mean we can expect that compiled version of annotations.proto will be available in google/go-genproto?

@tmc
Copy link
Collaborator Author

tmc commented Jul 28, 2016

@yugui yes that is the case.

For example, with just $GOPATH/src included in protoc -I I can now reference annotations like so: import "google.golang.org/genproto/googleapis/api/serviceconfig/annotations.proto"

and google.golang.org/genproto/googleapis/api/serviceconfig/annotations.pb.go exists.

@yugui
Copy link
Member

yugui commented Aug 16, 2016

https://github.com/grpc-ecosystem/grpc-gateway/tree/cleanup/use-go-genproto

I tried to move them, but it turned out that there's an compatibility issue.
Both google.golang.org/genproto/googleapis/api/serviceconfig and github.com/golang/protobuf/protoc-gen-go/plugin have references to their own version of descriptor.proto. They cannot coexist because the two instances of descriptor.pb.go collide with each other.

panic: proto: duplicate enum registered: google.protobuf.FieldDescriptorProto_Type

goroutine 1 [running]:
panic(0x1c89c0, 0xc42000c7e0)
        /usr/local/Cellar/go/1.7/libexec/src/runtime/panic.go:500 +0x1a1
github.com/golang/protobuf/proto.RegisterEnum(0x228685, 0x29, 0xc4200106f0, 0xc420010720)
        /Users/yugui/gengo/go/src/github.com/golang/protobuf/proto/properties.go:815 +0x13a
google.golang.org/genproto/protobuf.init.3()
        /Users/yugui/gengo/go/src/google.golang.org/genproto/protobuf/descriptor.pb.go:1888 +0x4d0
google.golang.org/genproto/protobuf.init()
        /Users/yugui/gengo/go/src/google.golang.org/genproto/protobuf/type.pb.go:394 +0xa67
google.golang.org/genproto/googleapis/api/serviceconfig.init()
        /Users/yugui/gengo/go/src/google.golang.org/genproto/googleapis/api/serviceconfig/usage.pb.go:189 +0x58
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor.init()
        /Users/yugui/gengo/go/src/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor/types.go:323 +0x76
main.init()
        /Users/yugui/gengo/go/src/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/main.go:119 +0x71

@yugui
Copy link
Member

yugui commented Aug 16, 2016

googleapis/go-genproto#9

@codesuki
Copy link

codesuki commented Mar 1, 2017

panic: proto: duplicate extension registered: descriptor.MethodOptions 72295728

I had this error when using the google datastore go library together with grpc-gateway.

I solved it like this:

  1. remove grpc gateways thirdparty folder from my vendor/
  2. go get github.com/googleapis/googleapis
  3. change protoc command to
	protoc	-I"${GOPATH}/src" \
		-I"${PWD}/vendor/github.com/googleapis/googleapis" \
		--go_out=plugins=grpc:"${GOPATH}/src" \
  • remove Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api
  • change import path

Hope this helps in case anyone else is experiencing this.

@tmc
Copy link
Collaborator Author

tmc commented Mar 14, 2017

genproto doesn't include proto files anymore so we need to keep vendoring -- #325 updates protos and includes the appropriate lines to rely on genproto for go files.

@tmc tmc closed this as completed Mar 14, 2017
@tamalsaha tamalsaha mentioned this issue Mar 30, 2017
1 task
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants