Regarding the problem of installing go plug-in in VSCode

  The more common go development and editing tools include VSCode, GoLand, etc. Among them, using VSCode requires downloading the relevant go language plug-in. But in most cases, the download will fail because some resources need to be bypassed. Sometimes, an error will still be reported after bypassing the wall.
  This article will introduce a method to help you successfully download the go plug-in. The editor has personally tested it and it can be used.

(1) Open the command line, check the go version and go environment variable information, and set GOPATH.

go version and environment variablesSetting GO_PATH can be done through the command line, or you can open the computer's environment variable to modify it to the specified directory.
environment variablesCommand line mode: set GO_PATH=D:\go\go-project

(2) Open VSCode and install the go plug-in.

Insert image description here

(3) Install other go plug-ins.

Note that the proxy address needs to be modified here, otherwise download failure will occur.

go env -w GO111MODULE=on
go env -w GOPROXY=https://proxy.golang.com.cn,direct

Press Ctrl+Shift+P on the Windows platform. At this time, an input box will pop up in the VSCode interface. We enter >go:install in this input box. Related commands will be automatically searched below. We select the command Go:Install/Update Tools. Press Enter to execute the command (or click the command with the mouse),
Insert image description hereselect all in the pop-up window, and click the "OK" button to install.
Insert image description hereWait a moment and the download and installation will be successful.

Guess you like

Origin blog.csdn.net/fish332/article/details/128969461