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

Support Go modules: fix protobuf imports #568

Closed
alpe opened this issue Apr 29, 2019 · 2 comments · Fixed by #664
Closed

Support Go modules: fix protobuf imports #568

alpe opened this issue Apr 29, 2019 · 2 comments · Fixed by #664
Assignees

Comments

@alpe
Copy link
Contributor

alpe commented Apr 29, 2019

Is your feature request related to a problem? Please describe.
With the recent introduction of Go modules the project must not live within the Gopath anymore.

As of Go 1.11, the go command enables the use of modules when the current directory or any parent directory has a go.mod, provided the directory is outside $GOPATH/src. (Inside $GOPATH/src, for compatibility, the go command still runs in the old GOPATH mode, even if a go.mod is found.

https://blog.golang.org/using-go-modules

While the Go code in the project works outside the GOPATH now the protobuf generation does not as files are depending on parent path structures.

Describe the solution you'd like
Make it fully work outside GOPATH as intended by the modules designers

Describe alternatives you've considered

Additional context
go list -f '{{ .Dir }}' -m github.com/golang/protobuf may become helpful to set a proper imports in the makefile. See https://www.reddit.com/r/golang/comments/9blgn0/using_go_modules_with_vendorprovided_protobuf/

@alpe
Copy link
Contributor Author

alpe commented Apr 29, 2019

With make deps the local vendor folder is created and it works outside the GOPATH as requested. I will close this now.

@alpe alpe closed this as completed Apr 29, 2019
@alpe
Copy link
Contributor Author

alpe commented Apr 29, 2019

Na, does not work with the imports to other weave components... 😭

@alpe alpe reopened this Apr 29, 2019
@husio husio self-assigned this May 23, 2019
husio added a commit that referenced this issue May 23, 2019
We no longer use `GOPATH` and `dep` for dependency management. Using Go
modules requires changes to how protobuf files are declared and
included.

- `protofmt` command no longer works as it does not accept `-I` flag
- `protodoc` is disabled for now as it requires a single protobuf. This
   is waiting for #659
- some packages cannot be compiled unless weave top level `codec.proto`
  is included. Compiler is printing a warning that this file is not
  used, but it does not compile without it. Weird.

fix #568
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants