{"id":764,"date":"2018-01-01T21:00:46","date_gmt":"2018-01-01T13:00:46","guid":{"rendered":"http:\/\/www.withonly.com\/?p=764"},"modified":"2018-08-13T10:16:11","modified_gmt":"2018-08-13T02:16:11","slug":"%e5%8e%8b%e7%bc%a9golang%e7%bc%96%e8%af%91%e7%9a%84%e5%8f%af%e6%89%a7%e8%a1%8c%e6%96%87%e4%bb%b6%e4%bd%93%e7%a7%af","status":"publish","type":"post","link":"https:\/\/blog.5danyuan.com\/?p=764","title":{"rendered":"\u538b\u7f29 Golang \u7f16\u8bd1\u7684\u53ef\u6267\u884c\u6587\u4ef6\u4f53\u79ef"},"content":{"rendered":"<p>\u81ea\u4ece\u63a5\u89e6 Golang \u4ee5\u6765\uff0c\u4e00\u76f4\u5bf9\u5176\u7f16\u8bd1\u51fa\u6765\u7684\u53ef\u6267\u884c\u6587\u4ef6\u6709\u70b9\u770b\u6cd5\uff0c\u56e0\u4e3a\u4f53\u79ef\u6bd4\u8f83\u5927\u3002\u4f7f\u7528 go build av.go\uff0c\u7f16\u8bd1\u7b80\u5355\u7684\u4ee3\u7801\u51fa\u6765\u540e\u5c31\u6709\u8fd18M\uff0c\u5f53\u7136\uff0c\u8fd9\u662f\u56e0\u4e3a\u628a Go \u7684\u8fd0\u884c\u65f6\u73af\u5883\u4e5f\u7ed9\u6253\u5305\u8fdb\u53bb\u4e86\u7684\u539f\u56e0\uff0c\u4e3a\u4e86\u51e0k\u7684\u6e90\u7801\u5b9e\u5728\u662f\u4e0d\u5212\u7b97\uff0c\u7279\u522b\u662f\u5728\u9999\u8549\u6d3e\/Firefly\u8fd9\u4e9b\u78c1\u76d8\u7a7a\u95f4\u7d27\u5f20\u7684\u8bbe\u5907\u4e0a\u9762\u3002<\/p>\n<p>\u4eca\u5929\u6709\u641c\u7d22\u4e00\u4e0b\u89e3\u51b3\u65b9\u6cd5\uff0cGolang \u7684\u5148\u884c\u8005\u7ed9\u51fa\u7684\u601d\u8def\u4e00\u5171\u5206\u4e3a2\u6b65\u3002<\/p>\n<p>\u7b2c\u4e00\u6b65\uff0c\u6dfb\u52a0\u7f16\u8bd1\u7b26\u53f7\u3002<\/p>\n<blockquote><p>go build -ldflags &#8220;-s -w&#8221; av.go<\/p><\/blockquote>\n<p>-s \u76f8\u5f53\u4e8estrip\u6389\u7b26\u53f7\u8868\uff0c \u4f46\u662f\u4ee5\u540e\u5c31\u6ca1\u529e\u6cd5\u5728gdb\u91cc\u67e5\u770b\u884c\u53f7\u548c\u6587\u4ef6\u4e86\u3002<br \/>\n-w \u544a\u77e5\u8fde\u63a5\u5668\u653e\u5f03\u6240\u6709debug\u4fe1\u606f<\/p>\n<p>\u8863\u670d\u81ea\u5df1\u6d17\u662f\u4f7f\u7528 LiteIDE \u6765\u7f16\u5199go\u4ee3\u7801\u7684\uff0c\u6309\u7167\u4e0b\u56fe\u6dfb\u52a0\u5373\u53ef\uff0c\u6ce8\u610f\u4e0d\u8981\u5fd8\u8bb0\u6dfb\u52a0\u5f15\u53f7\uff0c\u4e0d\u7136\u7f16\u8bd1\u662f\u65e0\u6cd5\u901a\u8fc7\u7684\u3002<\/p>\n<p><a href=\"\/wp-content\/uploads\/2018\/01\/4422.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-765\" src=\"\/wp-content\/uploads\/2018\/01\/4422.png\" alt=\"\" width=\"401\" height=\"270\" srcset=\"https:\/\/blog.5danyuan.com\/wp-content\/uploads\/2018\/01\/4422.png 401w, https:\/\/blog.5danyuan.com\/wp-content\/uploads\/2018\/01\/4422-300x202.png 300w\" sizes=\"auto, (max-width: 401px) 100vw, 401px\" \/><\/a><\/p>\n<p>\u8fd9\u6837\u4e00\u6765\uff0c\u7f16\u8bd1\u540e\u7684\u6587\u4ef6\u5c31\u662f5M\u591a\uff0c\u770b\u8d77\u6765\u8fd8\u662f\u6709\u70b9\u6548\u679c\u3002<\/p>\n<p>\u7b2c\u4e8c\u6b65\uff0c\u6211\u4eec\u4f7f\u7528UPX\u6765\u8fdb\u4e00\u6b65\u538b\u7f29\uff0c\u5176\u5730\u5740\u4e3a https:\/\/github.com\/upx\/upx\uff0c\u4e0b\u8f7d\u5bf9\u5e94\u7684\u7248\u672c\u5373\u53ef\u3002\u4f7f\u7528\u8d77\u6765\u4e5f\u5f88\u7b80\u5355\uff0c\u9ed8\u8ba4\u5373\u4e3a\u538b\u7f29\uff0c\u8f93\u5165upx av.exe \u5373\u53ef\u3002<\/p>\n<p>-d \u89e3\u538b\u7f29<br \/>\n-l \u67e5\u770b\u538b\u7f29\u524d\u540e\u4fe1\u606f<\/p>\n<p>\u73b0\u5728\u518d\u770b\uff0c\u4f53\u79ef\u5df2\u7ecf\u52301.7M\u5de6\u53f3\u4e86\uff0c\u6548\u679c\u5f88\u660e\u663e\uff0c\u5c31\u95ee\u4f60\u60ca\u4e0d\u60ca\u559c\uff0c\u610f\u4e0d\u610f\u5916\u3002<\/p>\n<p>\u7531\u4e8e\u4ee5\u524d\u6709\u6728\u9a6c\u75c5\u6bd2\u4e5f\u4f7f\u7528UPX\u6765\u52a0\u58f3\uff0c\u5bfc\u81f4\u73b0\u5728\u6740\u6bd2\u8f6f\u4ef6\u5bf9UPX\u4e0d\u592a\u53cb\u597d\u3002\u5982\u679c\u662f\u90e8\u7f72\u5728\u670d\u52a1\u7aef\u6216\u8005Linux\u7cfb\u7edf\u5e94\u8be5\u8fd8\u597d\uff0c\u7279\u522b\u662f\u9762\u5411windows\u7528\u6237\u53d1\u5e03\u7684\uff0c\u5404\u4f4d\u540c\u5b66\u8bf7\u614e\u91cd\uff0c\u53ef\u4ee5\u8003\u8651\u6dfb\u52a0\u6570\u5b57\u7b7e\u540d\u3002\u81f3\u4e8e\u5982\u4f55\u4f7f\u7528\u6570\u5b57\u7b7e\u540d\uff0c\u53ef\u4ee5\u53c2\u8003\u6211\u7684\u53e6\u5916\u4e00\u4e2a\u5e16\u5b50\u3002<\/p>\n<p>\u5bf9\u4e8e\u4ea7\u7ebf\u7684 Release \u7f16\u8bd1\uff0c\u4f7f\u7528\u81ea\u52a8\u5316\u5de5\u5177\u6765\u505a\u8fd9\u4e2a\u4e8b\u60c5\uff0c\u5e94\u8be5\u90fd\u662f\u5c0f\u83dc\u4e00\u789f\u4e86\uff0c\u5c31\u4e0d\u63d0\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u81ea\u4ece\u63a5\u89e6 Golang \u4ee5\u6765\uff0c\u4e00\u76f4\u5bf9\u5176\u7f16\u8bd1\u51fa\u6765\u7684\u53ef\u6267\u884c\u6587\u4ef6\u6709\u70b9\u770b\u6cd5\uff0c\u56e0\u4e3a\u4f53\u79ef\u6bd4\u8f83\u5927\u3002\u4f7f\u7528 go build a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[292,5],"tags":[293,285,165],"class_list":["post-764","post","type-post","status-publish","format-standard","hentry","category-golang","category-daily","tag-go","tag-golang","tag-165"],"_links":{"self":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/posts\/764","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=764"}],"version-history":[{"count":0,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/posts\/764\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=764"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}