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

Go get breaks with autogenerated code #331

Closed
jdoliner opened this issue Mar 21, 2017 · 5 comments
Closed

Go get breaks with autogenerated code #331

jdoliner opened this issue Mar 21, 2017 · 5 comments

Comments

@jdoliner
Copy link

We're seeing an issue when users attempt to go get a library that contains pb.go files which were built with grpc-gateway enabled. The issue seems to be that the files will include the line:

import _ "github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api"

Which doesn't contain any buildable go src files. It looks like it used to contain some but it currently doesn't in master. This results in the error:

package github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api: no buildable Go source files in /go/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api

I can think of a couple ways to fix this:

  • don't import that package, it seems like it can't be having much effect if there's no buildable src files in it
  • add an empty go file that just says package api in it so that go get will work
  • readd the compiled source for the protos, although presumably they were taken out for a reason so that might not be a good idea

Sorry if I'm missing something obvious here and misusing the library.

@tmc
Copy link
Collaborator

tmc commented Mar 21, 2017

@jdoliner thanks for the issue report. This likely means you have an outdated "M" mapping in your protoc invocation. Can you share how you are invoking protoc?

Your protoc line should appear as something akin to:

protoc -I. \
	-I${GOPATH}/src \
	-I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
	--go_out=plugins=grpc:. \
	foobar.proto

@jdoliner
Copy link
Author

@tmc, thanks for the quick response. That probably explains it here's our invocation:

protoc \
	-I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
	-I${GOPATH}/src/github.com/gogo/protobuf \
	-I${GOPATH}/src \
	-Isrc \
	--gogo_out=plugins=grpc,\
Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api,\
Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types,\
Mgogoproto/gogo.proto=github.com/gogo/protobuf/gogoproto,\
Mclient/pfs/pfs.proto=github.com/pachyderm/pachyderm/src/client/pfs,\
Mclient/pps/pps.proto=github.com/pachyderm/pachyderm/src/client/pps,\
Mserver/pfs/fuse/fuse.proto=github.com/pachyderm/pachyderm/src/server/pfs/fuse,\
:src \
foobar.proto

Looks like the incorrect "M" mapping we're using is the one for annotations? What should we be using instead?

@tmc
Copy link
Collaborator

tmc commented Mar 22, 2017

@jdoliner - I think you just need to eliminate 'Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api,' -- please report back.

@jdoliner
Copy link
Author

@tmc seems to have done the trick :), many thanks.

@tmc
Copy link
Collaborator

tmc commented Mar 22, 2017

@jdoliner thanks!

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

2 participants