bazel-contrib / bazel-contrib/rules_go
Allow pure without purego
- 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.48.0
### What version of gazelle are you using?
0.36.0
### What version of Bazel are you using?
bazel 6.4.x
### Does this issue reproduce with the latest releases of all the above?
yes
### What operating system and processor architecture are you using?
Linux
### Any other potentially useful information about your toolchain?
The application is built with `--@io_bazel_rules_go//go/config:pure` to have no dependencies on GLIBC (or any other c library) as this allows building minimal container images.
### What did you do?
Upgraded an application that uses google.golang.org/protobuf to the latest release of rules_go.
### What did you expect to see?
No changes in performance.
### What did you see instead?
The performance of the application has greatly reduced. Enabling "pure" now implies not using pointer arithmetic (https://github.com/search?q=repo%3Aprotocolbuffers%2Fprotobuf-go%20purego&type=code).
While it seems possible to add `gotags` in a `go_binary` it doesn't seem possible to take them away. Using `cgo = False` will still produce a dynamically linked executable (and require glibc at runtime).
Contributor guide
Research direction
Reproduce the application build with rules_go 0.48.0, Gazelle 0.36.0, Bazel 6.4.x, Linux, and the pure configuration. Inspect how the pure setting selects protobuf's purego implementation and how cgo = False affects linking; done means retaining a libc-free executable without the performance regression.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- build-system, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100