Solve the problem that the go plugin download fails in vscode

Due to network reasons, vscode automatically downloads go plugins with a high probability of failure, but vscode often pops up windows to install plugins. In order to solve this problem, we need to manually download the go plugin

Environment configuration

Replace go with domestic source

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

Manually download the go plugin

Show go environment

go env

Find in the output information GOPATHand enter the folder. Create a new folder under this folder go/src/golang.org/xand enter it, and then execute the following command.

git clone [email protected]:golang/tools.git
git clone [email protected]:golang/crypto.git
git clone [email protected]:golang/lint.git
git clone [email protected]:golang/xerrors.git
git clone [email protected]:golang/sync.git

Finally, in VSCode, use F1 or ctrl+shift+p to open the command panel, search Go: Install/Update Tools, and use this command to update the dependency of the plug-in. If the installation is completed without an error, it will succeed.

Guess you like

Origin blog.csdn.net/NelsonCheung/article/details/109443959