Golang VS Code plugin download failed to install
- 2020-10-23 20:59:39
- OfStack
I recently started learning Go language, but when I was writing Go using VS Code, the plugin couldn't be downloaded. My original solution was to download and install from github, but I didn't like that because I had to write Go using VS Code on multiple pc, so I thought it would be too much trouble to repeat it many times, and it would be too much trouble to install the plug-ins. I once wanted to give up learning Go at one point, and yes, it was too much trouble to install the plug-ins. After many times of searching, I finally found http:// goproxy.cn /, which is the domestic mirror of Go. If I use this, the problem that the Go plug-in cannot be downloaded can be solved.
(http:// goproxy. cn/ document introduction, easy to find later)
Windows can be entered in cmd
C:\
>
$env:GO111MODULE = "on"
C:\
>
$env:GOPROXY = "https://goproxy.cn"
or
[
. Open Start and search env
. Select edit System Environment Variables
Click on "Environment variables..." button
In"
<
Your username
>
"User variables" section (upper part)
Click "New..." button
. Select the Variable Name input box and type GO111MODULE
. Select the Variable Value input box and type "on"
. Click the OK button
Click "New..." button
. Select the Variable Name input box and type GOPROXY
. Select the Variable Value input box and enter "https:// goproxy.cn"
. Click the OK button
MacOS or Linux
$ export GO111MODULE=on
$ export GOPROXY=https://goproxy.cn
or
$ echo "export GO111MODULE=on" >> ~/.profile
$ echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
$ source ~/.profile
conclusion