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

Protoc on windows is highly confusing #2577

Closed
rogeralsing opened this issue Jan 11, 2017 · 4 comments
Closed

Protoc on windows is highly confusing #2577

rogeralsing opened this issue Jan 11, 2017 · 4 comments

Comments

@rogeralsing
Copy link

When using Protoc.exe on windows, it's somewhat a battle of trial and error in order to get import paths working correctly.

for example, we have this snippet

protoc --gogoslick_out=Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,plugins=grpc:. --proto_path=. --proto_path=$(GOPATH)/src protos.proto

Which works fine on *nix.

Trying to do the same on Windows, one would assume that we could simply swap out the GOPATH to match windows env vars like so:

protoc --gogoslick_out=Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,plugins=grpc:. --proto_path=. --proto_path=%GOPATH%/src protos.proto

This however results in google/protobuf/any.proto not found.
And I have verified that it does indeed exist at the github.com/gogo/protobuf/types folder.

Should we be able to use the same paths on windows as in nix or do we have to deal with different / vs \

Better error messages explaining in what folders it has tried to find the files would help alot

Currently, I have solved it using a hack, placing a "google/protobuf" folder with the relevant protos in %GOPATH%/src.
this makes it all work.

So the problem seems to be a mapping issue

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Jan 11, 2017

What is --gogoslick_out? It seems it's actually that gogoslick plugin who is responsible for the resolution of google/protobuf/any.proto=github.com/gogo/protobuf/types and it doesn't work on windows. Protoc itself doesn't fetch anything from remote services so you have to put the any.proto in some local path for protoc to work.

@rogeralsing
Copy link
Author

gogoslick_out is an alternative Golang generator.
So the plugins are responsible for resolving imports? I'll crosspost this in their repo in that case.
Thanks

@bcmills
Copy link

bcmills commented Jan 18, 2017

I don't think the --proto_path flag is specific to the Go generator plugin.

Do you have the same problem when generating protoc outputs for other languages? That would help narrow it down to protoc or protoc-gen-go. (It's certainly possible that we're using path somewhere we ought to be using filepath or vice-versa.)

@acozzette
Copy link
Member

Marking this closed since it sounds like it was resolved in the crossposted issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants