Closed cdelguercio closed 6 years ago
I think you have conflicting packages for the Well Known Types getting linked into your build. Gazelle resolves Go imports of WKTs to @io_bazel_rules_go//proto/wkt
, but this is quite recent, and there are a lot of build files that reference the old targets out there.
Try using rules_go ca213b3006c8eed6b3f1ea649cab36b817901b46
(currently tip of master
). That introduces aliases for WKT libraries so that fewer conflicts are possible. You may also need to avoid declaring com_github_golang_protobuf
explicitly; also watch out for org_golang_google_genproto
, though it doesn't look like you're declaring that.
Forgot to mention that your suggestion completely worked. Thanks!
I had the same issue. Solved it by replacing the deps //protobuf/field_mask:go_default_library
to @io_bazel_rules_go//proto/wkt:field_mask_go_proto
in @org_golang_google_genproto//googleapis/pubsub/v1/BUILD.bazel
I had the same issue, solved by explicitly depending on the latest org_golang_google_genproto
before I called go_rules_dependencies()
.
I'm trying to build a library I wrote to deal with Google Cloud pubsub, but I've ran into a strange error. When I run Bazel I get:
ERROR: /home/.../external/com_google_cloud_go/pubsub/BUILD.bazel:3:1: GoCompile external/com_google_cloud_go/pubsub/linux_amd64_stripped/go_default_library~/cloud.google.com/go/pubsub.a failed (Exit 1) bazel-out/k8-fastbuild/bin/external/io_bazel_rules_go/proto/wkt/linux_amd64_stripped/field_mask_go_proto~/google.golang.org/genproto/protobuf/field_mask/field_mask.pb.go:21:0: inconsistent definition for type field_mask.FieldMask during import struct { Paths []string "protobuf:\"bytes,1,rep,name=paths\" json:\"paths,omitempty\"" } (in "cloud.google.com/go/pubsub/apiv1") struct { Paths []string "protobuf:\"bytes,1,rep,name=paths\" json:\"paths,omitempty\""; XXX_NoUnkeyedLiteral struct {} "json:\"-\""; XXX_unrecognized []byte "json:\"-\""; XXX_sizecache int32 "json:\"-\"" } (in "google.golang.org/genproto/protobuf/field_mask") GoCompile: error running subcommand: exit status 1
Here's my BUILD.bazel
And the relevant parts of my WORKSPACE
Do I have two conflicting repositories somehow?