The following tutorial column will sort out the problems that occur in go encoding in vscode. I hope it will be helpful to friends in need!
Introduction
Preliminary preparation, must read
1. Configure the source of golang. go env -w GOPROXY=https://goproxy.cn,direct
Then we download the default tool service of golang tool:
2. Press on Windows platform
Ctrl Shift P, press
Command Shift P on Mac platform. At this time, an input box will pop up in the VS Code interface
>go:install in this input box. The following will automatically search for related commands. We select the command
Go:Install/Update Tools. Select it as shown below and it will return Car execute this commandSelect all in the pop-up window and click the "OK" button to install.
After executing this step, restart Vscode. If your problem can be solved at this time, there is no need to read further.
Specific problem solutions
1. F12 cannot jump in VSCode
1. Modify DocsTool to godoc
2. Uncheck Use Language Server 3. Restart VsCode
go mod mode
Import dependencies , this step will transfer the dependencies to the vendor (automatically created) folder in the root directory of the project
At this time, F12 can jump to the code.
2. The code automatic bring-out function fails
), then you need to setgo env -w GO111MODULE=offAt this time, the automatic bring-out function may be used correctly
If you are using the
go modmode, set
go env -w GO111MODULE= onThe automatic bring-out function can also be restored to normal.
The above is the detailed content of Sort out the problems that occur with go encoding in vscode. For more information, please follow other related articles on the PHP Chinese website!