This is a created article in which the information may have evolved or changed.
First give the conclusion: can reduce to the original 29%
Recently in writing a tlscat gadget github.com/mengzhuo/tlscat source file is only 2KB, but go build tlscat.go compiled with 4.6mb!
Later found this Golang 1.5 will solve the problem Issue #6853 all:binaries too big andgrowing but, I do not believe this evil, so the search for some of the gobuild usage of go build -ldflags "-s -w" '-s ' equivalent to strip off the symbol Table, but in the future there is no way to view the line number and file in GDB. The '-W ' flag to the linker to omit the debug information tells the connector to discard all debug information so it's only 3MB.
Then found in the Mac platform, there are upx such as the existence of God.
UPX achieves an excellent compression ratio and offers very fastdecompression.
In short, UPX is the ability to compress executable files and then decompress and run at very fast speeds.
Can be quickly installed with brew UPX brew install upx upx 可执行文件