{"id":1153,"date":"2022-10-07T03:06:00","date_gmt":"2022-10-07T03:06:00","guid":{"rendered":"https:\/\/262235.xyz\/?p=1153"},"modified":"2022-10-07T03:06:00","modified_gmt":"2022-10-07T03:06:00","slug":"1153","status":"publish","type":"post","link":"https:\/\/lyvba.com\/index.php\/2022\/10\/07\/1153\/","title":{"rendered":"\u4f7f\u7528VSCode \u5b66\u4e60Go\u8bed\u8a00, \u8bbe\u7f6e\u4ee3\u7801\u63d0\u793a\u81ea\u52a8\u8865\u5168\u529f\u80fd"},"content":{"rendered":"<p>Go \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u5b83\u80fd\u8ba9\u6784\u9020\u7b80\u5355\u3001\u53ef\u9760\u4e14\u9ad8\u6548\u7684\u8f6f\u4ef6\u53d8\u5f97\u5bb9\u6613\u3002<\/p>\n<p>Go\u662f\u4ece2007\u5e74\u672b\u7531Robert Griesemer, Rob Pike, Ken Thompson\u4e3b\u6301\u5f00\u53d1\uff0c\u540e\u6765\u8fd8\u52a0\u5165\u4e86Ian Lance Taylor, Russ Cox\u7b49\u4eba\uff0c\u5e76\u6700\u7ec8\u4e8e2009\u5e7411\u6708\u5f00\u6e90\uff0c\u57282012\u5e74\u65e9\u4e9b\u65f6\u5019\u53d1\u5e03\u4e86Go 1\u7a33\u5b9a\u7248\u672c\u3002\u73b0\u5728Go\u7684\u5f00\u53d1\u5df2\u7ecf\u662f\u5b8c\u5168\u5f00\u653e\u7684\uff0c\u5e76\u4e14\u62e5\u6709\u4e00\u4e2a\u6d3b\u8dc3\u7684\u793e\u533a\u3002<\/p>\n<p><a href=\"https:\/\/go.dev\/learn\/\"><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2022\/10\/1834031192.webp\" alt=\"go.dev.webp\" title=\"go.dev.webp\"><\/a><\/p>\n<h2><a href=\"https:\/\/go.dev\/dl\/go1.19.2.windows-amd64.msi\">\u4e0b\u8f7d\u9002\u7528\u4e8e Windows \u7684 Go<\/a><\/h2>\n<ul>\n<li><a href=\"https:\/\/go.dev\/dl\/go1.19.2.windows-amd64.msi\">go1.19.2.windows-amd64.msi (135 MB)<\/a><\/li>\n<\/ul>\n<h2>\u6559\u7a0b\uff1a\u5f00\u59cb\u4f7f\u7528 Go<\/h2>\n<ul>\n<li>\u7528\u4e8e\u7f16\u8f91\u4ee3\u7801\u7684\u5de5\u5177\u3002\u60a8\u62e5\u6709\u7684\u4efb\u4f55\u6587\u672c\u7f16\u8f91\u5668\u90fd\u53ef\u4ee5\u6b63\u5e38\u5de5\u4f5c\u3002\u5927\u591a\u6570\u6587\u672c\u7f16\u8f91\u5668\u90fd\u5bf9 Go \u6709\u5f88\u597d\u7684\u652f\u6301\u3002\u6700\u53d7\u6b22\u8fce\u7684\u662f VSCode\uff08\u514d\u8d39\uff09\u3001GoLand\uff08\u4ed8\u8d39\uff09\u548c Vim\uff08\u514d\u8d39\uff09\u3002<\/li>\n<\/ul>\n<h3>\u4f7f\u7528 <code>VSCode<\/code> \u65b0\u5efa <code>hello.go<\/code> \uff0c\u70b9\u51fb <code>Run Code<\/code> \u8fd0\u884c<\/h3>\n<pre><code>package main\n\nimport \"fmt\"\n\nfunc main() {\n    fmt.Println(\"Hello, \u4e16\u754c\")\n}<\/code><\/pre>\n<h2>VSCode \u5b89\u88c5Go\u8bed\u8a00\u5f00\u53d1\u5de5\u5177\u5305\uff0c\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u53ef\u4ee5\u63d0\u4f9b\u4ee3\u7801\u63d0\u793a\uff0c\u81ea\u52a8\u8865\u5168\u529f\u80fd\u3002<\/h2>\n<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2022\/10\/10246739.webp\" alt=\"go.webp\" title=\"go.webp\"><\/p>\n<h3>\u914d\u7f6e\u4ee3\u7406\uff1a\u7531\u4e8e\u56fd\u5185\u7f51\u7edc\u7684\u539f\u56e0\uff0c\u5bf9\u4e8e\u4e00\u4e9bgolang\u7684\u5f00\u53d1\u5305\u4e0b\u8f7d\u4e0d\u6210\u529f<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2022\/10\/3075629285.png\" alt=\"PATH.png\" title=\"PATH.png\"><\/p>\n<pre><code># \u5b89\u88c5\u7a0b\u5e8f\u81ea\u52a8\u6dfb\u52a0\nGOPATH = %USERPROFILE%go\n\n# \u6dfb\u52a0\u7cfb\u7edf\u53d8\u91cf\nGO111MODULE = auto\nGOPROXY = https:\/\/goproxy.cn,direct<\/code><\/pre>\n<h3>\u6309 <code>ctrl + shift +p<\/code> \u5728\u641c\u7d20\u6846\u4e2d\u8f93\u5165 <code>go:install<\/code> \u9009\u62e9 <code>Go:Install\/Update Tools<\/code> \u70b9\u51fb\uff0c\u5982\u56fe\uff1a<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2022\/10\/2922108558.gif\" alt=\"AA.gif\" title=\"AA.gif\"><\/p>\n<h2>\u6b63\u786e\u5b89\u88c5\u63d2\u4ef6\u5de5\u5177\u8f93\u51fa\u63d0\u793a<\/h2>\n<pre><code>Tools environment: GOPATH=C:Usersvipgo\nInstalling 7 tools at C:Usersvipgo\bin in module mode.\n  gotests\n  gomodifytags\n  impl\n  goplay\n  dlv\n  staticcheck\n  gopls\n\nInstalling github.com\/cweill\/gotests\/gotests@latest (C:Usersvipgo\bingotests.exe) SUCCEEDED\nInstalling github.com\/fatih\/gomodifytags@latest (C:Usersvipgo\bingomodifytags.exe) SUCCEEDED\nInstalling github.com\/josharian\/impl@latest (C:Usersvipgo\binimpl.exe) SUCCEEDED\nInstalling github.com\/haya14busa\/goplay\/cmd\/goplay@latest (C:Usersvipgo\bingoplay.exe) SUCCEEDED\nInstalling github.com\/go-delve\/delve\/cmd\/dlv@latest (C:Usersvipgo\bindlv.exe) SUCCEEDED\nInstalling honnef.co\/go\/tools\/cmd\/staticcheck@latest (C:Usersvipgo\binstaticcheck.exe) SUCCEEDED\nInstalling golang.org\/x\/tools\/gopls@latest (C:Usersvipgo\bingopls.exe) SUCCEEDED\n\nAll tools successfully installed. You are ready to Go. :)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Go \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u5b83\u80fd\u8ba9\u6784\u9020\u7b80\u5355\u3001\u53ef\u9760\u4e14\u9ad8\u6548\u7684\u8f6f\u4ef6\u53d8\u5f97\u5bb9\u6613\u3002 Go\u662f\u4ece2007\u5e74\u672b\u7531Rob [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[69,50],"class_list":["post-1153","post","type-post","status-publish","format-standard","hentry","category-learn","tag-golang","tag-vscode"],"_links":{"self":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/comments?post=1153"}],"version-history":[{"count":0,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1153\/revisions"}],"wp:attachment":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/media?parent=1153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/categories?post=1153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/tags?post=1153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}