1. normal build
go build .
Size of my binary: 20MB
2. ldflags
You can build app with additional parameters -ldflags="-s -w"
go build -ldflags="-s -w"
Size of my binary: 16MB
3. FINALY: upx
You can use upx
: The Ultimate packer for eXecutable
go build -ldflags="-s -w" -o mngr
upx mngr
Size of my binary: 6.0MB
suma sumarum
With upx i have got binary file 4 times smaller… Believe me. On size matter. Smaller is better 😀
installing upx
# on Mac
brew install upx