Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up label checking by making binary smaller #65

Merged
merged 1 commit into from
Jun 27, 2020
Merged

Conversation

johnboyes
Copy link
Contributor

This commit removes the DWARF debugging information[1], resulting in the
Docker image size shrinking from 4.76MB to 2.88MB.

Decided not to try to also turn off generation of the Go symbol table
using the -s flag, as:

  1. the GOFLAGS functionality currently only allows 1 ldflag to be set[2]
    (NB this may be fixed in Go 1.15[3])
  2. The improvements to the binary size in Go 1.15 [4] mean that the -s
    flag will no longer really do anything[5]

Will also try shrinking the binary size further using upx[6] in a
separate pull request.

[1] https://stackoverflow.com/a/22276273
[2] golang/go#38522
[3] golang/go#26849 (comment)
[4] See #64
[5] https://twitter.com/bradfitz/status/1256989624590712834
[6] https://upx.github.io/

This commit removes the DWARF debugging information[1], resulting in the
Docker image size shrinking from 4.76MB to 2.88MB.

Decided not to try to also turn off generation of the Go symbol table
using the `-s` flag, as:
1. the GOFLAGS functionality currently only allows 1 ldflag to be set[2]
   (NB this may be fixed in Go 1.15[3])
2. The improvements to the binary size in Go 1.15 [4] mean that the `-s`
   flag will no longer really do anything[5]

Will also try shrinking the binary size further using upx[6] in a
separate pull request.

[1] https://stackoverflow.com/a/22276273
[2] golang/go#38522
[3] golang/go#26849 (comment)
[4] See #64
[5] https://twitter.com/bradfitz/status/1256989624590712834
[6] https://upx.github.io/
@johnboyes johnboyes added the patch Semantic versioning: backwards compatible bug fixes label Jun 27, 2020
@johnboyes johnboyes merged commit 439da9e into master Jun 27, 2020
@johnboyes johnboyes deleted the shrink-binary branch June 27, 2020 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Semantic versioning: backwards compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant