bazel-contrib / bazel-contrib/rules_go
Stdlib is built 4 times
- Dominant language
- Go
- Stars
- 1.5k
- Forks
- 760
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 12
Description
For almost all `go_library` targets, rules_go builds 4 copies for stdlib: fastbuild vs opt (for tools), and cgo on vs. off. This happens to `go_library` targets that don't depend on cgo, e.g., `@bazel_gazelle//cmd/gazelle:gazelle_lib`. Also, I don't see a reason why we need to build stdlib for tools with both cgo on and off.
### What version of rules_go are you using?
0.39.0
### What version of gazelle are you using?
master branch
### What version of Bazel are you using?
6.1.1
### Does this issue reproduce with the latest releases of all the above?
Yes
### What operating system and processor architecture are you using?
macOS arm64
### Any other potentially useful information about your toolchain?
### What did you do?
Check out Gazelle repo and run `bazel aquery 'mnemonic(GoStdlib, deps(//cmd/gazelle:gazelle_lib))'`
### What did you expect to see?
There are only 1-2 `GoStdlib` actions
### What did you see instead?
4 `GoStdlib` actions, for fastbuild vs opt, and cgo on and off
Contributor guide
Research direction
Start by checking out the Gazelle repository and running `bazel aquery 'mnemonic(GoStdlib, deps(//cmd/gazelle:gazelle_lib))'` as described. Trace why the `GoStdlib` actions vary by fastbuild/opt and cgo configuration, then verify that the target produces only the expected one or two stdlib actions without redundant builds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100