Skip to content

Reset Go build modes for the Nogo tool - #15048

Closed
tamird wants to merge 1 commit into
google:masterfrom
tamird:nogo-reset-exec-mode
Closed

tamird wants to merge 1 commit into
google:masterfrom
tamird:nogo-reset-exec-mode

Conversation

@tamird

@tamird tamird commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Nogo's exec dependencies select the execution platform but retain the Go build modes of the package being analyzed. A static target can therefore make the analyzer link statically against the execution toolchain. This fails with the hermetic GNU toolchain, which provides shared glibc linking stubs rather than static archives 1.

Route all four Nogo tool dependencies through rules_go's go_reset_target 2, retaining their exec transitions for platform selection. This resets Go build modes before configuring the analyzer, independently of the package's static, race, or other mode settings. Keep the existing nogo binary and its analysis target available for direct use.

Assisted-by: Codex

@zkoopmans zkoopmans self-assigned this Sep 29, 2026

@zkoopmans zkoopmans left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for fixing the toolchain mode leak on :nogo

I may need to do some things internally to get this fixed so this will import.

copybara-service Bot pushed a commit that referenced this pull request Sep 30, 2026
Nogo's exec dependencies select the execution platform but retain the Go build modes of the package being analyzed. A static target can therefore make the analyzer link statically against the execution toolchain. This fails with the hermetic GNU toolchain, which provides shared glibc linking stubs rather than static archives [1].

Route all four Nogo tool dependencies through rules_go's go_reset_target [2], retaining their exec transitions for platform selection. This resets Go build modes before configuring the analyzer, independently of the package's static, race, or other mode settings. Keep the existing nogo binary and its analysis target available for direct use.

[1]: https://app.buildbuddy.io/invocation/00d0c051-3fef-4fcb-b279-b158879c216e
[2]: https://github.com/bazel-contrib/rules_go/blob/v0.57.0/go/private/rules/transition.bzl#L312-L339

Assisted-by: Codex
FUTURE_COPYBARA_INTEGRATE_REVIEW=#15048 from tamird:nogo-reset-exec-mode dca9ff6
PiperOrigin-RevId: 990407447
Nogo's exec dependencies select the execution platform but retain the Go
build modes of the package being analyzed. A static target can therefore
make the analyzer link statically against the execution toolchain. This
fails with the hermetic GNU toolchain, which provides shared glibc
linking stubs rather than static archives [1].

Route all four Nogo tool dependencies through rules_go's go_reset_target
[2], retaining their exec transitions for platform selection. This resets
Go build modes before configuring the analyzer, independently of the
package's static, race, or other mode settings. Keep the existing nogo
binary and its analysis target available for direct use.

[1]: https://app.buildbuddy.io/invocation/00d0c051-3fef-4fcb-b279-b158879c216e
[2]: https://github.com/bazel-contrib/rules_go/blob/v0.57.0/go/private/rules/transition.bzl#L312-L339

Assisted-by: Codex
@tamird
tamird force-pushed the nogo-reset-exec-mode branch from dca9ff6 to 4d09fd6 Compare October 1, 2026 02:32
copybara-service Bot pushed a commit that referenced this pull request Oct 1, 2026
Nogo's exec dependencies select the execution platform but retain the Go build modes of the package being analyzed. A static target can therefore make the analyzer link statically against the execution toolchain. This fails with the hermetic GNU toolchain, which provides shared glibc linking stubs rather than static archives [1].

Route all four Nogo tool dependencies through rules_go's go_reset_target [2], retaining their exec transitions for platform selection. This resets Go build modes before configuring the analyzer, independently of the package's static, race, or other mode settings. Keep the existing nogo binary and its analysis target available for direct use.

[1]: https://app.buildbuddy.io/invocation/00d0c051-3fef-4fcb-b279-b158879c216e
[2]: https://github.com/bazel-contrib/rules_go/blob/v0.57.0/go/private/rules/transition.bzl#L312-L339

Assisted-by: Codex
FUTURE_COPYBARA_INTEGRATE_REVIEW=#15048 from tamird:nogo-reset-exec-mode dca9ff6
PiperOrigin-RevId: 990407447
copybara-service Bot pushed a commit that referenced this pull request Oct 1, 2026
Nogo's exec dependencies select the execution platform but retain the Go build modes of the package being analyzed. A static target can therefore make the analyzer link statically against the execution toolchain. This fails with the hermetic GNU toolchain, which provides shared glibc linking stubs rather than static archives [1].

Route all four Nogo tool dependencies through rules_go's go_reset_target [2], retaining their exec transitions for platform selection. This resets Go build modes before configuring the analyzer, independently of the package's static, race, or other mode settings. Keep the existing nogo binary and its analysis target available for direct use.

[1]: https://app.buildbuddy.io/invocation/00d0c051-3fef-4fcb-b279-b158879c216e
[2]: https://github.com/bazel-contrib/rules_go/blob/v0.57.0/go/private/rules/transition.bzl#L312-L339

Assisted-by: Codex
COPYBARA_INTEGRATE_REVIEW=#15048 from tamird:nogo-reset-exec-mode dca9ff6
PiperOrigin-RevId: 991461175
@zkoopmans

Copy link
Copy Markdown
Contributor

Landed in master via commit 71a606a (cl/991461175) w/ original author credit to you. Closing!

@zkoopmans zkoopmans closed this Oct 1, 2026
@tamird
tamird deleted the nogo-reset-exec-mode branch October 1, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants