bazel-contrib / bazel-gazelle

Gazelle is a Bazel build file generator for Bazel projects. It natively supports Go and protobuf, and it may be extended to support new languages and custom rule sets.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gazelle hangs when enabling bzlmod

ewhauser opened this issue · comments

What version of gazelle are you using?

0.39.1

What version of rules_go are you using?

0.50.1

What version of Bazel are you using?

7.3.2

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

Yes

What operating system and processor architecture are you using?

OSX / ARM64

What did you do?

Ran bazel run //:gazelle

What did you expect to see?

Expect gazelle to run successfully in a short period of time. In our WORKSPACE build, gazelle usually completes in 5-10 seconds. A minimum repro is hard to produce due our full monorepo setup being necessary.

What did you see instead?

gazelle is hanging:

INFO: Running command line: /private/var/tmp/_bazel_ewhauser/c1fee43d9f70be2c9377b78115996411/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/gazelle
gazelle: finding module path for import buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate/priv: go: module buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go
@upgrade found (v1.35.1-20240920164238-5a7b106cbb87.1), but does not contain package buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate/priv

I don't see the above finding module path for import message when running gazelle without bzlmod enabled.

Stack dump here: https://gist.github.com/ewhauser/09d0fde8933ec03e53d90d89202f8580

I tracked this down to an empty REPO_CONFIG_PATH in the gazelle bash script. For me, the issue was missing some changes in a rebase against the gazelle definition in rules_proto. It seems that Aspect CLI's configure maybe also be suffering from the same issue. Not an issue in core gazelle so closing.