bazel-contrib / bazel-contrib/rules_go
Embedding native buildinfo in Bazel binaries
- Dominant language
- Go
- Stars
- 1.5k
- Forks
- 760
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 12
Description
### What version of rules_go are you using?
0.46.0
### What version of gazelle are you using?
0.34.0
### What version of Bazel are you using?
7.1.0
### Does this issue reproduce with the latest releases of all the above?
Yes
### What operating system and processor architecture are you using?
Darwin, x86_64
### Any other potentially useful information about your toolchain?
NA
### What did you do?
Build a binary target with the "pgoprofile" flag set. Then, inspect the build-info of the generated binary by running `go version -m `
### What did you expect to see?
Expect to see PGO option being listed in the build info among other flags, for example:
```
build -pgo=
build GOOS=<>
build GOARCH=<>
```
### What did you see instead?
```
: go1.22.3 X:nocoverageredesign
```
### Comments
I see that the issue of embedding build-info into the binary has been raised in #3090. However, I'm raising this issue to gain understanding on whether build-info other than the dependency info such as the one's I listed (specifically the pgo flag) can be embedded. If not, could I gain guidance on how I go about verifying whether or not a binary has a flag like pgo enabled.
Contributor guide
Research direction
Start by building a binary target with the pgoprofile flag and running `go version -m ` to confirm the missing PGO information. Read the discussion in issue #3090 for existing build-info context, then determine whether PGO settings can be embedded and make the resulting build info expose the flag as requested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100