I have a project that uses gin and etcd. Both gin(Godeps.json) and etcd(glide.yaml) use github.com/golang/protobuf, but they depend on different versions of it.
When I do glide install in my project, glide picks up the older version of the two (gin's dependent version).
[INFO] --> Fetching updates for github.com/golang/protobuf.
[INFO] --> Setting version for github.com/golang/protobuf to 2402d76f3d41f928c7902a765dfc872356dd3aad.
Naturally when I do go build, I get the following error:
../vendor/github.com/coreos/etcd/auth/authpb/auth.pb.go:37: undefined: proto.ProtoPackageIsVersion2
../vendor/github.com/coreos/etcd/auth/authpb/auth.pb.go:802: undefined: proto.RegisterFile
Basically etcd is expecting a different version of protobuf.
How can I work around this?
Thank you.
With @seh's help, I was able to work around it by adding github.com/golang/protobuf to my glide.yaml:
- package: github.com/golang/protobuf
version: 4bd1920723d7b7c925de087aa32e2187708897f7
glide did give warning when I did glide update, but it chose the later version.
[INFO] --> Parsing Godeps metadata...
[WARN] Conflict: github.com/golang/protobuf rev is currently 4bd1920723d7b7c925de087aa32e2187708897f7, but gopkg.in/gin-gonic/gin.v1 wants 2402d76f3d41f928c7902a765dfc872356dd3aad
[INFO] github.com/golang/protobuf reference 4bd1920723d7b7c925de087aa32e2187708897f7:
[INFO] - author: Joe Tsai <[email protected]>
[INFO] - commit date: Tue, 08 Nov 2016 23:27:36 -0800
[INFO] - subject (first line): Merge pull request #249 from Huawei-PTLab/master
[INFO] github.com/golang/protobuf reference 2402d76f3d41f928c7902a765dfc872356dd3aad:
[INFO] - author: David Symonds <[email protected]>
[INFO] - commit date: Wed, 06 Jan 2016 12:58:00 +1100
[INFO] - subject (first line): Add compatibility markers to proto generated code.
[INFO] Keeping github.com/golang/protobuf 4bd1920723d7b7c925de087aa32e2187708897f7
Most helpful comment
With @seh's help, I was able to work around it by adding
github.com/golang/protobufto myglide.yaml:glide did give warning when I did
glide update, but it chose the later version.