Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/go: cannot vendor protoc-gen-go if not imported in module code import #31239
What version of protobuf and what language are you using?
What did you do?
What did you expect to see?
I should be able to include a vendored dependency thats not imported by my go source code files to allow my dockerfile to build vendored .proto files without pregenerating them and commiting them to a repo. The reason for this is to ensure other users of my library do not ignore the .proto file and just use *.pb.go which could possibly be out of sync with its related .proto. If they have to use protoc everytime they pull my .proto file from my package then they are guarunteed to be in sync.
What did you see instead?
Including this import
This prevents any type of import being allowed when trynig to vendor protoc code.
The only option is to not use vendoring, and that requires me to put my gitlab https auth credentials directly in the docker file or environment variable so i can download gitlab dependencies which is not ideal.
The model for
If you check in the generated
To ensure that the files remain in sync, you can write a unit-test that invokes