{"id":299,"date":"2023-06-29T12:19:18","date_gmt":"2023-06-29T04:19:18","guid":{"rendered":"https:\/\/www.appbyme.cn\/myapp\/?p=299"},"modified":"2023-06-29T12:19:18","modified_gmt":"2023-06-29T04:19:18","slug":"go%e8%af%ad%e8%a8%80%e5%bc%80%e5%8f%91exe%e7%a8%8b%e5%ba%8f%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a1%b9","status":"publish","type":"post","link":"https:\/\/www.appbyme.cn\/myapp\/2023\/299\/","title":{"rendered":"go\u8bed\u8a00\u5f00\u53d1exe\u7a0b\u5e8f\u6ce8\u610f\u4e8b\u9879"},"content":{"rendered":"<p>\u5728<a href=\"https:\/\/www.yimenexe.com\/ruanjian-kaifa-1366.html\">mfc\u5c01\u88c5exe<\/a>\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u5c06\u5411\u60a8\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528Go\u8bed\u8a00\u5f00\u53d1\u72ec\u7acb\u7684Windows\u53ef\u6267\u884c\u6587\u4ef6\uff08.exe\uff09\u3002\u6211\u4eec\u5c06\u4eceGo\u8bed\u8a00\u7684\u5f00\u53d1\u73af\u5883\u8bbe\u7f6e\u5f00\u59cb\uff0c\u63a5\u7740\u6f14\u793a\u5982\u4f55\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684Go\u7a0b\u5e8f\uff0c\u5e76\u6700\u540e\u8bb2\u8ff0\u5982\u4f55\u5c06\u5176\u7f16\u8bd1\u4e3aWindows\u53ef\u6267\u884c\u6587\u4ef6\u3002\u5728\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u8fd8\u5c06\u63a2\u8ba8Go\u8bed\u8a00\u7684\u7279\u70b9\u53ca\u5728\u7a0b\u5e8f\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u7684\u4f18\u52bf\u3002<\/p>\n<p>### \u4e00\u3001Go\u8bed\u8a00\u7b80\u4ecb<\/p>\n<p>Go\uff08\u53c8\u79f0Golang\uff09\u662f\u4e00\u79cd\u9759\u6001\u7c7b\u578b\u3001\u7f16\u8bd1\u578b\u3001\u5e76\u53d1\uff08\u652f\u6301\u591a\u7ebf\u7a0b\u5904\u7406\uff09\u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u7531Google\u5f00\u53d1\u5e76\u57282009\u5e74\u53d1\u5e03\u3002Go\u8bed\u8a00\u5177\u6709\u7b80\u6d01\u3001\u6e05\u6670\u7684\u8bed\u6cd5\u7279\u70b9\uff0c\u6613\u4e8e\u7406\u89e3\u548c\u5b66\u4e60\u3002\u540c\u65f6\uff0c\u5b83\u8fd8\u5305\u542b\u4e86\u5783\u573e\u56de\u6536\u548c\u5185\u5b58\u7ba1\u7406\u529f\u80fd\uff0c\u7531\u6b64\u6781\u5927\u5730\u51cf\u8f7b\u4e86\u7a0b\u5e8f\u5458\u7684\u5de5\u4f5c\u8d1f\u62c5\u3002<\/p>\n<p>### \u4e8c\u3001Go\u8bed\u8a00\u5f00\u53d1\u73af\u5883\u8bbe\u7f6e<\/p>\n<p>\u5728\u5f00\u59cb\u7f16\u5199Go\u4ee3\u7801\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u914d\u7f6eGo\u8bed\u8a00\u7684\u5f00\u53d1\u73af\u5883\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u6b65\u9aa4\uff1a<\/p>\n<p>1. \u524d\u5f80Go\u8bed\u8a00\u5b98\u65b9\u7f51\u7ad9\uff08https:\/\/golang.org\/dl\/\uff09\u4e0b\u8f7d\u9002\u7528\u4e8e\u60a8\u64cd\u4f5c\u7cfb\u7edf\u7684Go\u5b89\u88c5\u5305\u3002<\/p>\n<p>2. \u6309\u7167\u5b89\u88c5\u6307\u5357\u5b8c\u6210\u5b89\u88c5\u8fc7\u7a0b\uff0c\u5c06Go\u6dfb\u52a0\u5230\u60a8\u7684\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\u3002<\/p>\n<p>3. \u9a8c\u8bc1Go\u73af\u5883\u662f\u5426\u5b89\u88c5\u6210\u529f\uff0c\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165`go version`\u3002\u5982\u679c\u8f93\u51faGo\u7684\u7248\u672c\u4fe1\u606f\uff0c\u8bf4\u660e\u60a8\u5df2\u6210\u529f\u5b89\u88c5\u3002<\/p>\n<p>### \u4e09\u3001\u7f16\u5199\u7b80\u5355\u7684Go\u7a0b\u5e8f<\/p>\n<p>\u73b0\u5728\u6211\u4eec\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684&#8221;Hello, World!&#8221;\u7a0b\u5e8f\u3002<\/p>\n<p>1. \u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\uff08\u5982Notepad++\u6216Visual Studio Code\uff09\u65b0\u5efa\u4e00\u4e2a\u540d\u4e3a`hello.go<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.cdn.yimenapp.com\/2023-03\/21\/14\/29329751452.jpg\" \/><\/figure>\n<\/p>\n<p>`\u7684\u6587\u4ef6\u3002<\/p>\n<p>2. \u7f16\u5199\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<p>&#8220;`go<\/p>\n<p>package main<\/p>\n<p>import &#8220;fmt&#8221;<\/p>\n<p>func main() {<\/p>\n<p>    fmt.Println(&#8220;Hello, World!&#8221;)<\/p>\n<p>}<\/p>\n<p>&#8220;`<\/p>\n<p>3. \u4fdd\u5b58\u6587\u4ef6\u3002<\/p>\n<p>### \u56db\u3001\u5c06Go\u7a0b\u5e8f\u7f16\u8bd1\u4e3aWindows\u7684\u53ef\u6267\u884c\u6587\u4ef6<\/p>\n<p>\u5b8c\u6210Go\u7a0b\u5e8f\u7684\u7f16\u5199\u540e\uff0c\u6211\u4eec\u9700\u8981\u5c06\u5176\u7f16\u8bd1\u4e3aWindows\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff08.exe\uff09\u3002<a href=\"https:\/\/exe.yimenapp.com\/tool-1885.html\">\u5c01\u88c5\u6210exe\u6587\u4ef6<\/a>\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\uff1a<\/p>\n<p>1. \u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u6216PowerShell\u3002<\/p>\n<p>2. \u4f7f\u7528`cd`\u547d\u4ee4\u5bfc\u822a\u5230\u5305\u542b`hello.go`\u6587\u4ef6\u7684\u6587\u4ef6\u5939\u3002<\/p>\n<p>3. \u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u7f16\u8bd1\u7a0b\u5e8f\uff1a<\/p>\n<p>&#8220;`bash<\/p>\n<p>go build -o hello.exe hello.go<\/p>\n<p>&#8220;`<\/p>\n<p>\u6b64\u547d\u4ee4\u7684\u542b\u4e49\u5982\u4e0b\uff1a<\/p>\n<p>&#8211; `go build`\uff1aGo\u8bed\u8a00\u7684\u7f16\u8bd1\u547d\u4ee4\u3002<\/p>\n<p>&#8211; `-o hello.exe`\uff1a\u6307\u5b9a\u8f93\u51fa\u6587\u4ef6\u540d\u4e3a`hello.exe`\u3002<\/p>\n<p>&#8211; `hello.go`\uff1a\u6307\u5b9a\u8981\u7f16\u8bd1\u7684Go\u6e90\u6587\u4ef6\u3002<\/p>\n<p>4. \u7f16\u8bd1\u6210\u529f\u540e\uff0c\u60a8\u4f1a\u5728\u5f53\u524d\u6587\u4ef6\u5939\u4e2d\u770b\u5230\u4e00\u4e2a\u540d\u4e3a`hello.exe`\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<p>\u73b0\u5728\uff0c\u60a8\u5df2\u7ecf\u5b66\u4f1a\u4e86\u5982\u4f55\u4f7f\u7528Go\u8bed\u8a00\u5f00\u53d1\u72ec\u7acb\u7684Windows\u53ef\u6267\u884c\u6587\u4ef6\u3002Go\u8bed\u8a00\u80fd\u591f\u8f7b\u677e\u5730\u7f16\u5199\u9ad8\u6548\u3001\u8de8\u5e73\u53f0\u7684\u7a0b\u5e8f\uff0c\u56e0\u6b64\u975e\u5e38\u9002\u7528\u4e8e\u5b9e\u9645\u5f00\u53d1\u573a\u666f\u3002\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u5bf9\u60a8\u7684\u5b66\u4e60\u548c\u5de5\u4f5c\u6709\u6240\u542f\u53d1\uff0c\u795d\u60a8\u53d6\u5f97\u66f4\u591a\u6210\u5c31\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u5c06\u5411\u60a8\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528Go\u8bed\u8a00\u5f00\u53d1\u72ec\u7acb\u7684Windows\u53ef\u6267\u884c\u6587\u4ef6\uff08.exe\uff09\u3002\u6211\u4eec\u5c06\u4eceGo\u8bed\u8a00\u7684\u5f00\u53d1\u73af\u5883\u8bbe\u7f6e\u5f00\u59cb\uff0c\u63a5\u7740\u6f14\u793a\u5982\u4f55\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684Go\u7a0b\u5e8f\uff0c\u5e76\u6700\u540e\u8bb2\u8ff0\u5982\u4f55\u5c06\u5176\u7f16\u8bd1\u4e3aWindow<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[92,722,89,721,235],"topic":[],"class_list":{"0":"post-299","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-diannao","7":"tag-92","8":"tag-exe","9":"tag-89","11":"tag-235"},"_links":{"self":[{"href":"https:\/\/www.appbyme.cn\/myapp\/wp-json\/wp\/v2\/posts\/299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appbyme.cn\/myapp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appbyme.cn\/myapp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appbyme.cn\/myapp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appbyme.cn\/myapp\/wp-json\/wp\/v2\/comments?post=299"}],"version-history":[{"count":0,"href":"https:\/\/www.appbyme.cn\/myapp\/wp-json\/wp\/v2\/posts\/299\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appbyme.cn\/myapp\/wp-json\/wp\/v2\/media?parent=299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appbyme.cn\/myapp\/wp-json\/wp\/v2\/categories?post=299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appbyme.cn\/myapp\/wp-json\/wp\/v2\/tags?post=299"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.appbyme.cn\/myapp\/wp-json\/wp\/v2\/topic?post=299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}