2019-06-12

压缩go build/install生成的binary大小

方法1:使用ldflags去掉debug info,效果不明显,而且去掉了debug info,不推荐
[code lang="bash"]go build -ldflags="-w -s" xxx/main.go[/code]

方法2:使用upx压缩已编译的binary,需要时间较长,效果明显,推荐
[code lang="bash"]upx --brute bin/xxx[/code]

没有评论:

发表评论