解決vscode安裝golang外掛(windows)問題

那麼遠,這麼近發表於2020-10-27

本人選擇安裝的是golang版本如下:

C:\WINDOWS\system32>go version
go version go1.15.3 windows/amd64

在配置完vs的基本設定後,使用自帶地址安裝golang外掛安裝失敗。因為國內網路原因,如果電腦已經“科學上網”的同學,可以不用看了。
下面進行解決:
1、開啟windows的powershell,輸入以下程式碼:

PS C:\Users\wutongyu>  $env:GO111MODULE="ON"
PS C:\Users\wutongyu> $env:GOPROXY="https://goproxy.io"

2、可以在vscode中安裝了

Tools environment: GOPATH=/Users/honglei/dev/go
Installing 17 tools at /Users/honglei/dev/go/bin in module mode.
  gocode
  gopkgs
  go-outline
  go-symbols
  guru
  gorename
  gotests
  gomodifytags
  impl
  fillstruct
  goplay
  godoctor
  dlv
  gocode-gomod
  godef
  goreturns
  golint

Installing github.com/mdempsky/gocode (/Users/honglei/dev/go/bin/gocode) SUCCEEDED
Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs (/Users/honglei/dev/go/bin/gopkgs) SUCCEEDED
Installing github.com/ramya-rao-a/go-outline (/Users/honglei/dev/go/bin/go-outline) SUCCEEDED
Installing github.com/acroca/go-symbols (/Users/honglei/dev/go/bin/go-symbols) SUCCEEDED
Installing golang.org/x/tools/cmd/guru (/Users/honglei/dev/go/bin/guru) SUCCEEDED
Installing golang.org/x/tools/cmd/gorename (/Users/honglei/dev/go/bin/gorename) SUCCEEDED
Installing github.com/cweill/gotests/... (/Users/honglei/dev/go/bin/gotests) SUCCEEDED
Installing github.com/fatih/gomodifytags (/Users/honglei/dev/go/bin/gomodifytags) SUCCEEDED
Installing github.com/josharian/impl (/Users/honglei/dev/go/bin/impl) SUCCEEDED
Installing github.com/davidrjenni/reftools/cmd/fillstruct (/Users/honglei/dev/go/bin/fillstruct) SUCCEEDED
Installing github.com/haya14busa/goplay/cmd/goplay (/Users/honglei/dev/go/bin/goplay) SUCCEEDED
Installing github.com/godoctor/godoctor (/Users/honglei/dev/go/bin/godoctor) SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv (/Users/honglei/dev/go/bin/dlv) SUCCEEDED
Installing github.com/stamblerre/gocode (/Users/honglei/dev/go/bin/gocode-gomod) SUCCEEDED
Installing github.com/rogpeppe/godef (/Users/honglei/dev/go/bin/godef) SUCCEEDED
Installing github.com/sqs/goreturns (/Users/honglei/dev/go/bin/goreturns) SUCCEEDED
Installing golang.org/x/lint/golint (/Users/honglei/dev/go/bin/golint) SUCCEEDED

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

好了,可以愉快的寫程式碼了!

相關文章