Closed unclejack closed 1 week ago
Greetings! Thanks for the PR.
It looks like buildid
is connected to the actual module/package contents and is used extensively in go build caching mechanism, so we would rather not change that. As for trimpath
since Talos is built inside the docker container I don't think it matters as much. The quick math shows that gains are also less than 0,1%:
(1-85156448/85209712)*100= 0,062%
(1-83324642/83390690)*100= 0,079%
(1-83042466/83095714)*100= 0,064%
(1-80609442/80674978)*100= 0,081%
(1-86274200/86331544)*100= 0,066%
(1-83755160/83820696)*100= 0,078%
(1-85026304/85077504)*100= 0,060%
(1-81434624/81485312)*100= 0,062%
Greetings! Thanks for the PR.
It looks like
buildid
is connected to the actual module/package contents and is used extensively in go build caching mechanism, so we would rather not change that.
What's the concern here? Could you please elaborate?
As for
trimpath
since Talos is built inside the docker container I don't think it matters as much. The quick math shows that gains >are also less than 0,1%:(1-85156448/85209712)*100= 0,062% (1-83324642/83390690)*100= 0,079% (1-83042466/83095714)*100= 0,064% (1-80609442/80674978)*100= 0,081% (1-86274200/86331544)*100= 0,066% (1-83755160/83820696)*100= 0,078% (1-85026304/85077504)*100= 0,060% (1-81434624/81485312)*100= 0,062%
Indeed, the gains will always be rather small with all such changes. Binaries won't become much smaller without some major changes made to Go itself.
Thanks for the feedback. I'll keep this in my fork. Cheers!
Pull Request
What? (description)
This makes the built Go binaries smaller. This sets a deterministic buildid based on the commit has. The other change is the removal of the prefix of the build directory. This isn't relevant for the built binary.
These changes make it possible to reduce the sizes of the binaries slightly and to produce the same binaries with the same version of the Go compiler.
The sizes of the talosctl binaries have been reduced slightly with these changes.
binary old size new size difference talosctl-darwin-amd64 85209712 85156448 53264 talosctl-darwin-arm64 83390690 83324642 66048 talosctl-freebsd-amd64 83095714 83042466 53248 talosctl-freebsd-arm64 80674978 80609442 65536 talosctl-linux-amd64 86331544 86274200 57344 talosctl-linux-arm64 83820696 83755160 65536 talosctl-linux-armv7 80871576 80871576 0 talosctl-windows-amd64.exe 85077504 85026304 51200 talosctl-windows-arm64.exe 81485312 81434624 50688
Why? (reasoning)
Having more reproducible binaries and smaller binaries is a good idea.
Acceptance
Please use the following checklist:
make conformance
)make fmt
)make lint
)make docs
)make unit-tests
)