bazel-gazelle icon indicating copy to clipboard operation
bazel-gazelle copied to clipboard

Allow `update-repos` to find all transitive dependencies, not just those listed in `go.mod`

Open cgrindel opened this issue 1 year ago • 0 comments

What version of gazelle are you using?

0.31.1

What version of rules_go are you using?

0.40.1

What version of Bazel are you using?

6.2.1

Does this issue reproduce with the latest releases of all the above?

Yes.

What operating system and processor architecture are you using?

MacOS/x86_64

What did you do?

I want to build a Go package with an executable (e.g. github.com/ekalinin/github-markdown-toc.go). The dependencies for this package are defined in the main package of the executable. As a result, running go get github.com/ekalinin/github-markdown-toc.go in my repo does not populate my go.mod with the transitive dependencies for the package. It merely adds the github.com/ekalinin/github-markdown-toc.go. After running update-repos and //:gazelle (i.e. update build files), executing the build fails because the transitive dependencies for github.com/ekalinin/github-markdown-toc.go are not found.

Note: I am running with bzlmod enabled.

What did you expect to see?

With bzlmod enabled, I expected update-repos to resolve all of the transitive dependencies for my dependency, just like it does when generating the legacy go_deps.bzl.

What did you see instead?

See above.

Related Slack thread

cgrindel avatar Jul 21 '23 14:07 cgrindel