-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: report trimpath erasing ldflags, and allow override
Add a new boolean option -trimldflags. Only meaningful when -trimpath is true. Defaults to true for backwards compatibility. Otheriwise when set to false reports ldflags in buildinfo, in spite of -trimpath setting. Also when ldflags are trimmed from the output, leave a reproducible marker that it happened. The difference between `-trimpath` and `-trimpath -trimldflags=false` shown below for a compilation with ldflags set: ```diff $ diff -u default.txt trimldflags\=false.txt --- default.txt 2024-04-26 18:51:15.106892203 +0100 +++ trimldflags=false.txt 2024-04-26 18:50:19.187008488 +0100 @@ -137,7 +137,7 @@ dep sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= build -buildmode=exe build -compiler=gc - build -trimldflags=true + build -ldflags="-X main.Version=234" build -trimpath=true build DefaultGODEBUG=asynctimerchan=1,gotypesalias=0 build CGO_ENABLED=1 ``` Fixes: golang#63432
- Loading branch information
Showing
5 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters