{"id":6177,"date":"2023-08-22T12:19:02","date_gmt":"2023-08-22T04:19:02","guid":{"rendered":"https:\/\/h5app.yimenapp.cn\/h5app\/2023\/ruanjiankf\/6177\/"},"modified":"2023-08-22T12:19:02","modified_gmt":"2023-08-22T04:19:02","slug":"goland%e9%85%8d%e7%bd%ae%e7%94%9f%e6%88%90exe%e6%96%87%e4%bb%b6%e6%ad%a5%e9%aa%a4%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/h5app.yimenapp.cn\/h5app\/2023\/ruanjiankf\/6177\/","title":{"rendered":"goland\u914d\u7f6e\u751f\u6210exe\u6587\u4ef6\u6b65\u9aa4\u4ecb\u7ecd"},"content":{"rendered":"<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u5b66\u4e60\u5982\u4f55\u4f7f\u7528GoLand\u914d\u7f6e\u751f\u6210exe\u6587\u4ef6\u3002Golang\u662f\u8c37\u6b4c\u53d1\u5e03\u7684\u4e00\u79cd\u5f00\u6e90\u7f16\u7a0b\u8bed\u8a00\uff0c\u5b83\u4f7f\u7a0b\u5e8f\u5458\u80fd\u591f\u8f7b\u677e\u521b\u5efa\u7b80\u5355\u3001\u53ef\u7ef4\u62a4\u4e14\u9ad8\u6548\u7684\u8f6f\u4ef6\u3002\u6211\u4eec\u5c06\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u914d\u7f6eGoLan<a href=\"https:\/\/www.yimenexe.com\/ruanjian-kaifa-2742.html\">py\u6587\u4ef6\u600e\u4e48\u751f\u6210exe\u6587\u4ef6<\/a>d\uff0c\u5e76\u751f\u6210\u4e00\u4e2aexe\u6587\u4ef6\u3002<\/p>\n<p>### \u51c6\u5907\u73af\u5883<\/p>\n<p>1. \u9996\u5148\uff0c\u4ece[\u5b98\u65b9\u7f51\u7ad9](https:\/\/golang.org\/dl\/)\u4e0b\u8f7d\u5e76\u5b89\u88c5Golang\u3002<\/p>\n<p>2. \u63a5\u7740\uff0c\u5728[JetBrains\u5b98\u65b9\u7f51\u7ad9](https:\/\/www.jetbrains.com\/go\/download\/)\u4e0b\u8f7d\u5e76\u5b89\u88c5GoLand\u3002<\/p>\n<p>\u5728\u5b8c\u6210\u5b89\u88c5\u4e4b\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u8fdb\u5165\u5230GoLand\u73af\u5883\u914d\u7f6e\u90e8\u5206\u3002<\/p>\n<p>### \u521b\u5efaGo\u9879\u76ee<\/p>\n<p>\u6253\u5f00GoLand IDE\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Go\u9879\u76ee\uff1a<\/p>\n<p>1. \u5355\u51fb\u201cCreate New Project\u201d\u3002<\/p>\n<p>2. \u9009\u62e9\u201cGo\u201d\u3002<\/p>\n<p>3. \u4e3a\u9879\u76ee\u8bbe\u7f6e\u540d\u79f0\u3001\u8def\u5f84\u4ee5\u53ca\u5176\u4ed6\u76f8\u5173\u4fe1\u606f\u3002<\/p>\n<p>4. \u6700\u540e\u5355\u51fb\u201cCreate\u201d\u4ee5\u521b\u5efa\u9879\u76ee\u3002<\/p>\n<p>\u73b0\u5728\u6211\u4eec\u5df2\u7ecf\u6210\u529f\u521b\u5efa\u4e86\u4e00\u4e2aGo\u9879\u76ee\uff0c\u63a5\u4e0b\u6765\u5c06\u4f1a\u6f14\u793a\u5982\u4f55\u5728\u9879\u76ee\u4e2d\u751f\u6210exe\u6587\u4ef6\u3002<\/p>\n<p>### \u7f16\u5199\u793a\u4f8b\u4ee3\u7801<\/p>\n<p>\u5728\u9879\u76ee\u76ee\u5f55\u4e0b\uff0c\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a\u201cmain.go\u201d\u7684\u6587\u4ef6\uff0c\u5e76\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!<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.cdn.yimenapp.com\/2023-03\/29\/12\/12876044978.jpg\" \/><\/figure>\n<\/p>\n<p>&#8220;)<\/p>\n<p>}<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u662f\u4e00\u4e2a\u7b80\u5355\u7684Go\u7a0b\u5e8f\uff0c\u8f93\u51fa&#8221;Hello, World!&#8221; \u5b57\u7b26\u4e32\u3002<\/p>\n<p>### \u914d\u7f6eGo<a href=\"https:\/\/www.yimenexe.com\/ruanjian-kaifa-6855.html\">\u600e\u4e48\u7f16\u8bd1\u751f\u6210exe\u6587\u4ef6\u5462<\/a>Land\u4ee5\u751f\u6210exe\u6587\u4ef6<\/p>\n<p>\u5728GoLand\u4e2d\uff0c\u751f\u6210exe\u6587\u4ef6\u7684\u8fc7\u7a0b\u79f0\u4e3a\u201cBuild\u201d\u3002\u4e3a\u4e86\u5b9e\u73b0\u8fd9\u4e2a\u76ee\u6807\uff0c\u6211\u4eec\u9700\u8981\u8bbe\u7f6e\u4e00\u4e2a\u201cRun Configuration\u201d\u3002<\/p>\n<p>1. \u6253\u5f00\u9879\u76ee\uff0c\u67e5\u627e\u9876\u90e8\u5bfc\u822a\u680f\u4e0a\u7684\u201cRun\u201d\u83dc\u5355\uff0c\u7136\u540e\u5355\u51fb\u201cEdit Configurations\u2026\u201d\u3002<\/p>\n<p>2. \u5728\u5f39\u51fa\u7684\u5bf9\u8bdd\u6846\u4e2d\uff0c\u5355\u51fb\u5de6\u4e0a\u89d2\u7684&#8221;+&#8221;\u53f7\uff0c\u7136\u540e\u9009\u62e9\u201cGo Build\u201d\u3002<\/p>\n<p>3. \u586b\u5199\u201cName\u201d\u5b57\u6bb5\uff0c\u53d6\u4e2a\u540d\u5b57\uff0c\u4f8b\u5982\u201cBuild EXE\u201d\u3002\u6ce8\u610f\uff0c\u201cRun kind\u201d\u5b57\u6bb5\u5e94as \u201cFile\u201d\uff0c\u8fd9\u8868\u793a\u6211\u4eec\u60f3\u4e3a\u67d0\u4e2a\u6587\u4ef6\u751f\u6210exe\u6587\u4ef6\u3002<\/p>\n<p>4. \u5728\u201cFile field\u201d\u4e2d\uff0c\u9009\u62e9\u6211\u4eec\u4e4b\u524d\u521b\u5efa\u7684\u201cmain.go\u201d\u6587\u4ef6\u3002<\/p>\n<p>5. \u5728\u201cOutput directory\u201d\u5b57\u6bb5\u4e2d\uff0c\u8bbe\u7f6e\u4e00\u4e2a\u76ee\u5f55\u6765\u5b58\u50a8\u751f\u6210\u7684exe\u6587\u4ef6\u3002<\/p>\n<p>6. \u786e\u4fdd\u9009\u4e2d\u201cBuild before run\u201d\u590d\u9009\u6846\uff0c\u4ee5\u786e\u4fdd\u5728\u8fd0\u884c\u4ee3\u7801\u4e4b\u524d\u8fdb\u884c\u7f16\u8bd1\u3002<\/p>\n<p>7. \u6700\u540e\u5355\u51fb\u201cApply\u201d\u6309\u94ae\uff0c\u7136\u540e\u5355\u51fb\u201cOK\u201d\u6309\u94ae\u6765\u4fdd\u5b58\u8bbe\u7f6e\u3002<\/p>\n<p>### \u751f\u6210exe\u6587\u4ef6<\/p>\n<p>\u73b0\u5728\u6211\u4eec\u5df2\u7ecf\u914d\u7f6e\u4e86GoLand\u751f\u6210exe\u6587\u4ef6\uff0c\u6211\u4eec\u53ef\u4ee5\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c\u4ee5\u751f\u6210exe\u6587\u4ef6\u3002<\/p>\n<p>1. \u8fd4\u56de\u5230GoLand\u754c\u9762\uff0c\u627e\u5230\u9876\u90e8\u5bfc\u822a\u680f\u4e0a\u7684\u7eff\u8272\u64ad\u653e\u6309\u94ae\uff0c\u70b9\u51fb\u5b83\u5e76\u9009\u62e9\u521a\u624d\u521b\u5efa\u7684\u914d\u7f6e\uff0c\u4f8b\u5982\u201cBuild EXE\u201d\u3002<\/p>\n<p>2. \u70b9\u51fb\u8fd0\u884c\uff0c\u751f\u6210exe\u6587\u4ef6\u7684\u8fc7\u7a0b\u5c06\u5f00\u59cb\u3002\u4f60\u53ef\u4ee5\u5728\u8f93\u51fa\u7a97\u53e3\u770b\u5230\u7f16\u8bd1\u8fc7\u7a0b\u3002<\/p>\n<p>3. \u5728\u5b8c\u6210\u540e\uff0c\u524d\u5f80\u4e4b\u524d\u8bbe\u7f6e\u7684\u201cOutput directory\u201d\uff0c\u60a8\u5c06\u5728\u90a3\u91cc\u627e\u5230\u751f\u6210\u7684exe\u6587\u4ef6\u3002<\/p>\n<p>\u73b0\u5df2\u5b8c\u6210\u4e86exe\u6587\u4ef6\u7684\u7f16\u8bd1\u53ca\u751f\u6210\u3002\u8fd9\u6837\u6211\u4eec\u5c31\u53ef\u4ee5\u8f7b\u677e\u5730\u5728\u5176\u4ed6Windows\u73af\u5883\u4e2d\u8fd0\u884c\u6b64\u7a0b\u5e8f\u800c\u65e0\u9700Go\u73af\u5883\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u5b66\u4e60\u5982\u4f55\u4f7f\u7528GoLand\u914d\u7f6e\u751f\u6210exe\u6587\u4ef6\u3002Golang\u662f\u8c37\u6b4c\u53d1\u5e03\u7684\u4e00\u79cd\u5f00\u6e90\u7f16\u7a0b\u8bed\u8a00\uff0c\u5b83\u4f7f\u7a0b\u5e8f\u5458\u80fd\u591f\u8f7b\u677e\u521b\u5efa\u7b80\u5355\u3001\u53ef\u7ef4\u62a4\u4e14\u9ad8\u6548\u7684\u8f6f\u4ef6\u3002\u6211\u4eec\u5c06\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u914d\u7f6eGoLand\uff0c\u5e76\u751f\u6210\u4e00\u4e2ae<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[11328,11329,3076,81,913],"topic":[],"class_list":["post-6177","post","type-post","status-publish","format-standard","hentry","category-ruanjiankf","tag-condaexe","tag-mfc-exe","tag-3076","tag-81","tag-913"],"_links":{"self":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/6177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/comments?post=6177"}],"version-history":[{"count":0,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/6177\/revisions"}],"wp:attachment":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/media?parent=6177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/categories?post=6177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/tags?post=6177"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/topic?post=6177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}