mwitkow / go-proto-validators

Generate message validators from .proto annotations.
Apache License 2.0
1.09k stars 164 forks source link

Bazel: avoid link conflict when depending on github.com/golang/protobuf/protoc-gen-go/descriptor #89

Closed jayconrod closed 4 years ago

jayconrod commented 4 years ago

Go 1.15 and rules_go are starting to get more strict about conflicts that occur when linking multiple copies of the same package. This happens frequently with Well Known Types since there are two separate targets for each proto: one built from pre-generated sources (for developers not using go_proto_library) and one built with go_proto_library.

A conflict is introduced in //:_validators_golang due to a dependency on @com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library. I think the deps attribute can be dropped from this target. It's compiled with @io_bazel_rules_go//proto:go_proto, which already has an implicit dependency on @io_bazel_rules_go//proto/wkt:descriptor_go_proto.

I'm not sure if this also affects the gogo targets, too; I don't know them well enough to suggest a change.