Context:
go 1.2, ubuntu 12.10
Goal:
Reduce size of compiled binaries
Currently in my build process, I run "go install" to generate the binary.
The I read from somewhere that if I pass in -w
it will shrink the binary.
I tried it by passing it into the -ldflags
option & my binary lost 1MB in size.
- Is this
-w
flag documented anywhere? What does it actually do? - I then discovered the
strip -s <binary>
command and ran that on top of-w
and got another weight loss of 750KB ! The resulting binary runs fine. Does stripping cause problems in any situations ?