-
Notifications
You must be signed in to change notification settings - Fork 46
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
adjust protoc execution to work with Go modules #663
Conversation
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
Note this in https://github.com/iov-one/weave/blob/master/prototool.yaml # Additional paths to include with -I to protoc.
# By default, the directory of the config file is included,
# or the current directory if there is no config file.
includes:
- .
- ./vendor
- ../../.. I'm looking to see how to configure this via cli or environment, but this is where you can pass the -I info down the chain |
Looking here I also noticed:
While we install v3.7.0 via the Makefile ( (This is an older issue, predating this PR) |
I have just found out on the prototool page that it does not play well with the long names as well. https://github.com/uber/prototool#tips-and-tricks |
Running Please exclude |
Also, lines like this seem to be odd: weave/cmd/bnsd/app/codec.proto Lines 6 to 7 in 574c919
weave/cmd/bnsd/x/nft/username/codec.proto Lines 6 to 7 in 574c919
|
Two of those three tips are against our attempts to vendor... |
Maybe this is a good config to use as reference: https://github.com/QubitProducts/iris/blob/master/prototool.yaml Or we just use prototool in a docker container. And save a whole lot of headaches. We can fork the docker container and set the versions inside to anything we want. But don't worry about having to build protobuf with the same source/deps as the actual running code. Maybe we just use protoc in docker as well... |
If I remove the USER="$(id -u):$(id -g)"
docker run -it --rm --user $USER --mount type=bind,source="$(pwd)",target=/work --tmpfs /tmp:exec charithe/prototool-docker prototool format /work/codec.proto |
Very interesting...
We can just make sure our prototool.yaml is set up well, and run all the scripts from the docker image, and I think this will save a whole lot of nightmares with protoc setup and tool configurations. |
@ethanfrey this can be closed because your approach is working, correct? |
Yes, protoc and prototools now work in docker. |
This is a draft as there are few tasks to be completed before merging.
We no longer use
GOPATH
anddep
for dependency management. Using Gomodules requires changes to how protobuf files are declared and
included.
protofmt
command no longer works as it does not accept-I
flagprotodoc
is disabled for now as it requires a single protobuf. Thisis waiting for cmd/collectproto: a new tool for collecting protobuf #659
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