-1

I am building a go binary and it is using go module through vendor to manage the dependencies. But each time I am building the binary an error like "proto.IsVersion3" is presented.

Now I think this may be because the dependency under vendor doesn't have its own vendor again, that is to say, sub-package. But how can I overcome this issue?

The whole process is like `go mod init && go mod tidy && go mod vendor && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=off go (1.12) build ....'

No9527
  • 31
  • 9
  • 1
    Without knowing all the details, it sounds like a version conflict with your generated protobuf code, most likely you have an issue similar too: https://stackoverflow.com/questions/53952723/undefined-proto-protopackageisversion3. Can you include the full error message? – Blokje5 Mar 30 '22 at 08:47
  • Sure. First in the go.mod, there is a indirect import like: github.com/aaa/bbb which contains just a proto file and a pb.go generated from it. And then I run go mod tidy && go mod vendor to make the github.com/aaa/bbb repo under the vendor folder under my code root(same level as go.mod). And then I run the above `go build` and fails because of `.pb.go:28:11: undefined: proto.ProtoPackageIsVersion3`. – No9527 Mar 30 '22 at 09:03
  • And My guess is because the folder under vendor doesn't have its own vendor or other forms of dependencies again. – No9527 Mar 30 '22 at 09:07
  • 1
    Modules aren’t going to work correctly if you turn modules off. – JimB Mar 30 '22 at 11:15
  • Thank you both for the quick answers, it really helped to solve this issue! I solved this problem by just replacing the protobuf version to a newer one, it seems the protobuf v1.1.0 isn't implemented `ProtoPackageIsVersion3` – No9527 Mar 31 '22 at 01:21

1 Answers1

0

With feedback from above answers, I solved this problem by just replacing the protobuf version to a newer one, it seems the protobuf v1.1.0 isn't implemented ProtoPackageIsVersion3

mazecreator
  • 543
  • 1
  • 11
  • 27
No9527
  • 31
  • 9