{"id":5820,"date":"2017-07-27T15:37:17","date_gmt":"2017-07-27T07:37:17","guid":{"rendered":"https:\/\/sdeno.com\/?p=5820"},"modified":"2023-04-24T18:24:52","modified_gmt":"2023-04-24T10:24:52","slug":"%e4%bd%bf%e7%94%a8gvm%e5%ae%89%e8%a3%85go","status":"publish","type":"post","link":"https:\/\/sdeno.com\/?p=5820","title":{"rendered":"\u4f7f\u7528gvm\u5b89\u88c5go"},"content":{"rendered":"<p>\/\/1\uff0c\u5b89\u88c5<\/p>\n<pre>bash &lt; &lt;(curl -s -S -L https:\/\/raw.githubusercontent.com\/moovweb\/gvm\/master\/binscripts\/gvm-installer)<\/pre>\n<p>&nbsp;<\/p>\n<p>\/\/2\uff0cgvm\u7acb\u5373\u751f\u6548\uff0c\uff08\u5b89\u88c5gvm\u65f6\uff0c\u4f1a\u6709\u76f8\u5e94\u7684\u76ee\u5f55\u63d0\u793a\uff09<\/p>\n<pre>source \/Users\/xgllseo\/.gvm\/scripts\/gvm<\/pre>\n<p>&nbsp;<\/p>\n<p>\/\/3\uff0c\u628agvm\u76ee\u5f55\u5230\u73af\u5883\u53d8\u91cf\u4e2d\u3002\u5728mac\u4e2d\u7f16\u8f91 ~\/.zshrc \uff0c\u5728\u6700\u540e\u52a0\u5165\u6b64\u4ee3\u7801\u3002\u8fd9\u6837\u65b9\u4fbf\u5173\u95edshell\u7a97\u53e3\u540e\u4f1a\u518d\u6b21\u6253\u5f00\u80fd\u627e\u5230gvm\u547d\u4ee4<\/p>\n<pre>[[ -s \"\/Users\/xgllseo\/.gvm\/scripts\/gvm\" ]] &amp;&amp; source \"\/Users\/xgllseo\/.gvm\/scripts\/gvm\"<\/pre>\n<p>\u5982\u679c\u4e0d\u60f3\u4f7f\u7528gvm\u5b89\u88c5\u7684go \u90a3\u5c31\u8981\u8fdb\u5165\u5230~\/.zshrc \u628a\u4ee5\u4e0a\u7684\u4ee3\u7801\u5220\u9664\u6216\u8005\u6ce8\u91ca<\/p>\n<p>&nbsp;<\/p>\n<p>\/\/4\uff0c\u6709\u7248\u672c\u53f7\uff0c\u8bf4\u660e\u5b89\u88c5\u6210\u529f<\/p>\n<pre>gvm version<\/pre>\n<p>&nbsp;<\/p>\n<p>\/\/5\uff0c\u5217\u51fa\u5f53\u524d\u53ef\u4ee5\u5b89\u88c5\u7684go\u7248\u672c<\/p>\n<pre>gvm listall<\/pre>\n<p>&nbsp;<\/p>\n<p>\/\/6\uff0c\u5b89\u88c5\u6307\u5b9a\u7248\u672c\uff0c\u4f8b\u5982<\/p>\n<pre>gvm install go1.8.3 -B\r\n\u4e5f\u53ef\u4ee5\u4f7f\u7528\u81ea\u5df1\u7684\u955c\u50cf\u5e93\r\ngvm install go1.3 --source=https:\/\/mozillazg@bitbucket.org\/mozillazg\/go<\/pre>\n<p>&nbsp;<\/p>\n<p>\/\/7\uff0c\u5df2\u7ecf\u5b89\u88c5\u7684\u5e76\u4e14\u5728\u4f7f\u7528\u54ea\u4e2a\u7248\u672c\u7684go<\/p>\n<pre>gvm list<\/pre>\n<p>&nbsp;<\/p>\n<p>\/\/8\uff0c\u5207\u6362go\u7248\u672c\uff0c\u5173\u95ed\u5f53\u524dshell\u540e\u518d\u6b21\u6253\u5f00\u4f9d\u7136\u6709\u6548\uff08\u4e34\u65f6\u5207\u6362\u5c31\u4e0d\u9700\u8981default\uff09<\/p>\n<pre>gvm use go1.8.3 --default<\/pre>\n<p>&nbsp;<\/p>\n<pre>\/\/\u67e5\u770b\u5f53\u524dgo\u7248\u672c\u7684\u76ee\u5f55\r\nwhich go<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;win\u73af\u5883\u4e0b\u5b89\u88c5&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/sdeno.com\/wp-content\/uploads\/2017\/07\/g1.3.0.windows-amd64.zip\">g1.3.0.windows-amd64<\/a><\/p>\n<p>g\u7248\u672c\u5207\u6362\u5b98\u7f51\uff1a<a href=\"https:\/\/github.com\/voidint\/g\/releases\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/voidint\/g\/releases<\/a><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">1\uff0c\u4e0b\u8f7dgvm\u4e5f\u5c31\u662fg.exe\u653e\u5230c\u76d8\u4e0bgvm\u76ee\u5f55\u4e2d\r\n2\uff0c\u914d\u7f6e\u73af\u5883\u53d8\u91cf\r\nG_HOME C:\\gvm\r\nG_MIRROR https:\/\/golang.google.cn\/dl\/\r\nGOROOT C:\\Users\\\u4f60\u7684\u7528\u6237\u540d\u76ee\u5f55\\.g\\go\r\n\r\n3\uff0c\u7f16\u8f91Path\u53d8\u91cf\uff0c\u65b0\u589e\u4ee5\u4e0b\r\n%G_HOME%\r\n%GOROOT%\\bin<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">g ls \u67e5\u8be2\u5df2\u5b89\u88c5\u7684go\u7248\u672c\r\ng ls-remote  \u67e5\u8be2\u53ef\u4f9b\u5b89\u88c5\u7684\u6240\u6709go\u7248\u672c\r\ng ls-remote stable \u67e5\u8be2\u5f53\u524d\u53ef\u4f9b\u5b89\u88c5\u7684stable\u72b6\u6001\u7684go\u7248\u672c\r\ng install 1.14.6 \u5b89\u88c5\u76ee\u6807go\u7248\u672c1.14.6\r\ng use 1.14.6 \u5207\u6362\u81f31.14.6\u7248\u672c\r\ng uninstall 1.14.6 \u5378\u8f7d\u4e00\u4e2a\u5df2\u5b89\u88c5\u7684go\u7248\u672c\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u5b98\u65b9\u4e0b\u8f7d\u7248\u672c\uff1a<a href=\"https:\/\/go.dev\/dl\/\" target=\"_blank\" rel=\"noopener\">https:\/\/go.dev\/dl\/<\/a><\/p>\n<p><a href=\"https:\/\/go.dev\/dl\/go1.18.3.windows-amd64.msi\" target=\"_blank\" rel=\"noopener\">https:\/\/go.dev\/dl\/go1.18.3.windows-amd64.msi<\/a><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>\u76ee\u524dwin\u73af\u5883\u4e0b\u6ca1\u6709gvm\u6765\u5b89\u88c5go\uff0c\u53ea\u80fd\u4ece\u5b98\u7f51\u4e0a\u4e0b\u8f7d\u5bf9\u5e94\u7684\u7248\u672cgo\u5b89\u88c5\u3002\u8fd9\u91cc\u7b80\u5355\u4ecb\u7ecd\u4e0b<\/p>\n<p>\u7cfb\u7edf32\u4f4d\u4e0b\u8f7di386<\/p>\n<p>64\u4e0b\u8f7damd64\u3002<\/p>\n<p>\u5230\u5b98\u7f51\u4e0b\u8f7d\uff0c\u5b89\u88c5\u5305\u63a8\u8350\u4e0b\u8f7dmsi\u683c\u5f0f\u7684\uff1a<a href=\"http:\/\/golang.org\/\" target=\"_blank\" rel=\"noopener\">http:\/\/golang.org\/<\/a><\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u9ed8\u8ba4\u8def\u5f84\u662fc:\\go\\\u4e4b\u540e\u6211\u4eec\u9700\u8981\u624b\u52a8\u914d\u7f6e\u73af\u5883\uff0c\u6253\u5f00win\u7684\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u754c\u9762\u3002<\/p>\n<figure class=\"mdx-lazyload-container\" style=\"max-width:486px\"><div style=\"padding-top:65.020576131687%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"486\" height=\"316\" class=\"alignnone size-full wp-image-5822 lazyload\" title=\"gopath\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"https:\/\/sdeno.com\/wp-content\/uploads\/2017\/07\/gopath.jpg\" alt=\"gopath\"><\/figure>\n<p>PATH\u6dfb\u52a0;C:\\Go\\bin<\/p>\n<p>&nbsp;<\/p>\n<figure class=\"mdx-lazyload-container\" style=\"max-width:491px\"><div style=\"padding-top:87.983706720978%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"491\" height=\"432\" class=\"alignnone size-full wp-image-5823 lazyload\" title=\"gohuanjing1\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"https:\/\/sdeno.com\/wp-content\/uploads\/2017\/07\/gohuanjing1.jpg\" alt=\"gohuanjing1\"><\/figure>\n<p>GOROOT\u6dfb\u52a0C:\\Go\\<\/p>\n<p>\u4f9d\u6b21\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u4e2d\u201d \u65b0\u5efa\u6dfb\u52a0\u4ee5\u4e0b\u53d8\u91cf<\/p>\n<p>GOARCH \u00a0 \u00a0amd64<\/p>\n<p>GOBIN \u00a0\u00a0%GOROOT%bin<\/p>\n<p>GOOS \u00a0\u00a0windows<\/p>\n<p>GOPATH \u00a0\u00a0C:\\gowork<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>GOROOT\uff1aGo\u7684\u5b89\u88c5\u76ee\u5f55<br \/>\nGOPATH\uff1a\u7528\u4e8e\u5b58\u653eGo\u8bed\u8a00Package\u7684\u76ee\u5f55\uff0c\u8fd9\u4e2a\u76ee\u5f55\u4e0d\u80fd\u5728Go\u7684\u5b89\u88c5\u76ee\u5f55\u4e2d<br \/>\nGOBIN\uff1aGo\u4e8c\u8fdb\u5236\u6587\u4ef6\u5b58\u653e\u76ee\u5f55\uff0c\u5199\u6210%GOROOT%\\bin\u5c31\u597d<br \/>\nGOOS\uff1a\u64cd\u4f5c\u7cfb\u7edf<br \/>\nGOARCH\uff1a\u6307\u5b9a\u7cfb\u7edf\u73af\u5883\uff0ci386\u8868\u793ax86\uff0camd64\u8868\u793ax64<br \/>\nPATH\uff1a\u9700\u8981\u5c06%GOBIN%\u52a0\u5728PATH\u53d8\u91cf\u7684\u6700\u540e\uff0c\u65b9\u4fbf\u5728\u547d\u4ee4\u884c\u4e0b\u8fd0\u884cGo<br \/>\n\u6211\u4eec\u8fd8\u53ef\u4ee5\u4f7f\u7528go env\u6765\u67e5\u770b\u6240\u6709\u5176\u4ed6\u7684\u73af\u5883\u53d8\u91cf\u7684\u5b9a\u4e49<\/p>\n<p>\u4ee5\u4e0b\u662f\u6211\u7684\u914d\u7f6e\uff1a<\/p>\n<figure class=\"mdx-lazyload-container\" style=\"max-width:329px\"><div style=\"padding-top:40.425531914894%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"329\" height=\"133\" class=\"alignnone size-full wp-image-5824 lazyload\" title=\"set_go\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"https:\/\/sdeno.com\/wp-content\/uploads\/2017\/07\/set_go.jpg\" alt=\"set_go\"><\/figure>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;\u542f\u52a8http&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>\u4f8b\u5982\u5728window\u73af\u5883\u4e0b\uff0c\u9ed8\u8ba4\u4f1a\u5b89\u88c5\u5728C:\\go\u76ee\u5f55\u4e2d\uff0c\u5728cmd\u547d\u4ee4\u4e0b\u5207\u6362\u5230go\u76ee\u5f55\u76f4\u63a5\u6267\u884c\u547d\u4ee4\uff1a<\/p>\n<pre>godoc -http=:8080<\/pre>\n<p>\u4e4b\u540e\u5728\u6d4f\u89c8\u5668\u4e2d\u8f93\u5165\uff1a<\/p>\n<pre>http:\/\/127.0.0.1:8080<\/pre>\n<p>\u5c31\u80fd\u8bbf\u95ee\u5230\uff0c\u5b98\u65b9\u7684\u672c\u5730\u6587\u6863<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/\/1\uff0c\u5b89\u88c5 bash &lt; &lt;(curl -s -S -L https:\/\/raw.githubu [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47],"tags":[],"class_list":["post-5820","post","type-post","status-publish","format-standard","hentry","category-go"],"_links":{"self":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/5820","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5820"}],"version-history":[{"count":0,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/5820\/revisions"}],"wp:attachment":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5820"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5820"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}