1

My bazel build fails with the following error

link: package conflict error: github.com/golang/protobuf/ptypes/timestamp: multiple copies of package passed to linker:
    @io_bazel_rules_go//proto/wkt:timestamp_go_proto
    @com_github_golang_protobuf//ptypes/timestamp:timestamp
Set "importmap" to different paths or use 'bazel cquery' to ensure only one
package with this path is linked.

In the error message, I see use 'bazel cquery' to ensure only one package, how can I find out who brings/uses @com_github_golang_protobuf//ptypes/timestamp:timestamp using bazel cquery?

Mohammed
  • 637
  • 13
  • 26
  • [This query](https://www.google.com/search?q=link%3A+package+conflict+error%3A+github.com%2Fgolang%2Fprotobuf%2Fptypes%2Ftimestamp%3A+multiple+copies+of+package+passed+to+linker) brings in a lot of relevant issues in the Bazel's tracker. Do their discussions help resolve your issue? – kostix Jul 19 '23 at 15:33
  • Tried what most of the results says including `bazel run :gazelle -- update-repos -from_file=go.mod -prune=true -build_file_proto_mode=disable -to_macro=repositories.bzl%go_repositories` , mostly saying `disable proto` which I did but no luck. – Mohammed Jul 19 '23 at 15:37

1 Answers1

1

Found the query

bazel cquery "somepath(//..., @com_github_golang_protobuf//ptypes/timestamp:timestamp)"
Mohammed
  • 637
  • 13
  • 26