window搭建go环境

下载go的window安装包:
软件下载地址:https://studygolang.com/dl
手册地址:https://studygolang.com/pkgdoc

windows安装,下一步下一步就好,
然后就是配置GOPATH的环境(go的安装路径)和PATH的环境(go的安装路径下的bin路径)

代理服务配置:

$ go env -w GO111MODULE=on
$ go env -w GOPROXY=https://goproxy.cn,direct

打开vscode,然后搜索go的扩展,然后安装。

Installing 15 tools at D:goin in module mode.
  go-outline
  go-symbols
  guru
  gorename
  gotests
  gomodifytags
  impl
  fillstruct
  goplay
  godoctor
  dlv
  gocode-gomod
  godef
  goreturns
  golint

以上的安装扩展一般需要FQ的,或者自己手动github下载。以上使用七牛云的代理服务可以直接下载。

Installing github.com/ramya-rao-a/go-outline (D:goingo-outline.exe) SUCCEEDED
Installing github.com/acroca/go-symbols (D:goingo-symbols.exe) SUCCEEDED
Installing golang.org/x/tools/cmd/guru (D:goinguru.exe) SUCCEEDED
Installing golang.org/x/tools/cmd/gorename (D:goingorename.exe) SUCCEEDED
Installing github.com/cweill/gotests/... (D:goingotests.exe) SUCCEEDED
Installing github.com/fatih/gomodifytags (D:goingomodifytags.exe) SUCCEEDED
Installing golang.org/x/tools/gopls (D:goingopls.exe) SUCCEEDED

All tools successfully installed. You are ready to Go :).
Installing github.com/josharian/impl (D:goinimpl.exe) SUCCEEDED
Installing github.com/davidrjenni/reftools/cmd/fillstruct (D:goinfillstruct.exe) SUCCEEDED
Installing github.com/haya14busa/goplay/cmd/goplay (D:goingoplay.exe) SUCCEEDED
Installing github.com/godoctor/godoctor (D:goingodoctor.exe) SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv (D:goindlv.exe) SUCCEEDED
Installing github.com/stamblerre/gocode (D:goingocode-gomod.exe) SUCCEEDED
Installing github.com/rogpeppe/godef (D:goingodef.exe) SUCCEEDED
Installing github.com/sqs/goreturns (D:goingoreturns.exe) SUCCEEDED
Installing golang.org/x/lint/golint (D:goingolint.exe) SUCCEEDED

All tools successfully installed. You are ready to Go :).

以上就配置好了go的扩展,开发时可以自动添加go的扩展包啦

原文地址:https://www.cnblogs.com/justsus/p/14067572.html