bazel-gazelle
bazel-gazelle copied to clipboard
`findGoTool` uses the system Go when it should use the Go defined in the Bazel workspace
What version of gazelle are you using?
0.34.0
What version of rules_go are you using?
0.43.0
What version of Bazel are you using?
7.0.0rc4
Does this issue reproduce with the latest releases of all the above?
Yes
What operating system and processor architecture are you using?
Linux/x86_64
What did you do?
Ran update-repos
.
What did you expect to see?
Expected success.
What did you see instead?
INFO: Running command line: bazel-bin/go_update_repos.sh
WARNING: Option 'experimental_remote_build_event_upload' is deprecated: Use --remote_build_event_upload instead
INFO: Invocation ID: 19961e51-ceb8-4ccc-b369-16eebae1e224
Computing main repo mapping:
WARNING: Option 'experimental_remote_build_event_upload' is deprecated: Use --remote_build_event_upload instead
Loading:
Loading: 0 packages loaded
Analyzing: target //:gazelle_bin (0 packages loaded, 0 targets configured)
Analyzing: target //:gazelle_bin (0 packages loaded, 0 targets configured)
[0 / 1] [Prepa] BazelWorkspaceStatusAction stable-status.txt
INFO: Analyzed target //:gazelle_bin (25 packages loaded, 126 targets configured).
[25 / 45] GoCompilePkg external/gazelle~0.34.0~go_deps~org_golang_x_mod/modfile/modfile.a; 0s remote-cache, linux-sandbox ... (5 actions running)
[43 / 45] [Prepa] GoCompilePkg gazelle_bin.a
INFO: Found 1 target...
Target //:gazelle_bin up-to-date:
bazel-bin/gazelle_bin_/gazelle_bin
INFO: Elapsed time: 3.474s, Critical Path: 2.95s
INFO: 45 processes: 11 internal, 34 linux-sandbox.
INFO: Build completed successfully, 45 total actions
INFO: Running command line: bazel-bin/gazelle_bin_/gazelle_bin update-repos '-from_file=go.mod' '-to_macro=go_deps.bzl%swift_bazel_go_dependencies' -bzlmod '-build_external=external'
gazelle: error from go list: running '/usr/local/go/bin/go go list -mod=readonly -e -m -json all': go: errors parsing go.mod:
/home/chuck/code/cgrindel/rules_swift_package_manager/upgrade_gazelle_to_0_33_0/go.mod:5: unknown directive: toolchain
exit status 1
The Linux system has Go 1.19.4 installed.
$ go version
go version go1.19.4 linux/amd64
The Go version in rules_go
0.43.0 is 1.21.4.
$ bazel run @io_bazel_rules_go//go -- version
WARNING: Option 'experimental_remote_build_event_upload' is deprecated: Use --remote_build_event_upload instead
INFO: Invocation ID: a914589e-1ad5-4935-95b0-1780ea045a33
WARNING: Option 'experimental_remote_build_event_upload' is deprecated: Use --remote_build_event_upload instead
INFO: Analyzed target @@rules_go~0.43.0//go:go (0 packages loaded, 1 target configured).
INFO: Found 1 target...
Target @@rules_go~0.43.0//go/tools/go_bin_runner:go_bin_runner up-to-date:
bazel-bin/external/rules_go~0.43.0/go/tools/go_bin_runner/go_bin_runner_/go_bin_runner
INFO: Elapsed time: 1.083s, Critical Path: 0.81s
INFO: 4 processes: 4 internal.
INFO: Build completed successfully, 4 total actions
INFO: Running command line: bazel-bin/external/rules_go~0.43.0/go/tools/go_bin_runner/go_bin_runner_/go_bin_runner version
go version go1.21.4 linux/amd64
It would be ideal for Gazelle to use the Go defined in the Bazel workspace. Perhaps, we can pass the location of Go as a flag to the gazelle binary.