VSCode安裝go相關(guān)插件失敗的簡(jiǎn)單解決方案
1. GO環(huán)境信息
C:\Users\home>go version
go version go1.18.2 windows/amd64
C:\Users\home>
安裝go插件之后,VSCode開始寫代碼會(huì)提示安裝其他插件,錯(cuò)誤信息如下:
Installing 8 tools at C:\Go\repository\bin in module mode.
gotests
gomodifytags
impl
goplay
dlv
staticcheck
gopls
go-outline
Installing github.com/cweill/gotests/gotests@latest FAILED
Installing github.com/fatih/gomodifytags@latest FAILED
Installing github.com/josharian/impl@latest FAILED
Installing github.com/go-delve/delve/cmd/dlv@latest FAILED
Installing github.com/haya14busa/goplay/cmd/goplay@latest FAILED
Installing github.com/go-delve/delve/cmd/dlv@latest FAILED
Installing honnef.co/go/tools/cmd/staticcheck@latest FAILED
Installing honnef.co/go/tools/cmd/staticcheck@latest FAILED
Installing golang.org/x/tools/gopls@latest FAILED
Installing github.com/ramya-rao-a/go-outline@latest FAILED
無法下載插件只能通過設(shè)置GOPROXY代理解決
go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/
修改之后
Installing 8 tools at C:\Go\repository\bin in module mode.
gotests
gomodifytags
impl
goplay
dlv
staticcheck
gopls
go-outline
Installing github.com/cweill/gotests/gotests@latest (C:\Go\repository\bin\gotests.exe) SUCCEEDED
Installing github.com/fatih/gomodifytags@latest (C:\Go\repository\bin\gomodifytags.exe) SUCCEEDED
Installing github.com/josharian/impl@latest (C:\Go\repository\bin\impl.exe) SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv@latest (C:\Go\repository\bin\dlv.exe) SUCCEEDED
Installing github.com/haya14busa/goplay/cmd/goplay@latest (C:\Go\repository\bin\goplay.exe) SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv@latest (C:\Go\repository\bin\dlv.exe) SUCCEEDED
Installing honnef.co/go/tools/cmd/staticcheck@latest (C:\Go\repository\bin\staticcheck.exe) SUCCEEDED
Installing honnef.co/go/tools/cmd/staticcheck@latest (C:\Go\repository\bin\staticcheck.exe) SUCCEEDED
Installing golang.org/x/tools/gopls@latest (C:\Go\repository\bin\gopls.exe) SUCCEEDED
1 tools failed to install.
impl: failed to install impl(github.com/josharian/impl@latest): Error: Command failed: C:\Go\bin\go.exe install -v github.com/josharian/impl@latest
go: github.com/josharian/impl@latest: module github.com/josharian/impl: reading https://mirrors.aliyun.com/goproxy/github.com/josharian/impl/@v/list: 404 Not Found
Installing golang.org/x/tools/gopls@latest (C:\Go\repository\bin\gopls.exe) SUCCEEDED
Installing github.com/ramya-rao-a/go-outline@latest FAILED
{
"killed": false,
"code": 1,
"signal": null,
"cmd": "C:\\Go\\bin\\go.exe install -v github.com/ramya-rao-a/go-outline@latest",
"stdout": "",
"stderr": "go: github.com/ramya-rao-a/go-outline@latest: no matching versions for query \"latest\"\n"
}
1 tools failed to install.
go-outline: failed to install go-outline(github.com/ramya-rao-a/go-outline@latest): Error: Command failed: C:\Go\bin\go.exe install -v github.com/ramya-rao-a/go-outline@latest
go: github.com/ramya-rao-a/go-outline@latest: no matching versions for query "latest"
還是有一個(gè)報(bào)錯(cuò),未能成功安裝全部插件,然后切換到%GOPATH%\pkg\mod\github.com目錄,例如
C:\Go\repository\pkg\mod\github.com
執(zhí)行如下命令
git clone https://github.com/josharian/impl
然后切換到GOPATH目錄,執(zhí)行如下命令
PS C:\go\repository> go install github.com/josharian/impl@latest PS C:\go\repository> go install github.com/ramya-rao-a/go-outline@latest go: downloading github.com/ramya-rao-a/go-outline v0.0.0-20210608161538-9736a4bde949 go: downloading golang.org/x/tools v0.1.1 PS C:\go\repository>
上述命令結(jié)束之后,重啟VSCode,這下寫Go代碼就沒有問題了。
總結(jié)
到此這篇關(guān)于VSCode安裝go相關(guān)插件失敗的簡(jiǎn)單解決方案的文章就介紹到這了,更多相關(guān)VSCode安裝go插件失敗內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
一文搞懂如何實(shí)現(xiàn)Go 超時(shí)控制
這篇文章主要介紹了一文搞懂如何實(shí)現(xiàn)Go 超時(shí)控制,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-03-03golang 對(duì)私有函數(shù)進(jìn)行單元測(cè)試的實(shí)例
這篇文章主要介紹了golang 對(duì)私有函數(shù)進(jìn)行單元測(cè)試的實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2021-05-05Go語言實(shí)現(xiàn)控制臺(tái)輸入&生成隨機(jī)數(shù)詳解
這篇文章主要介紹了Go語言如何實(shí)現(xiàn)控制臺(tái)輸入&生成隨機(jī)數(shù),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2022-05-05golang中的三個(gè)點(diǎn) ''...''的用法示例詳解
這篇文章主要介紹了golang中的三個(gè)點(diǎn) '...' 的用法示例詳解,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-11-11