Previous Go study notes (1) Install the Go language environment
Install Visual Studio Code
This is by far the best text editor I've ever used.
https://code.visualstudio.com/
There are several confirmations in the middle, including file association and adding environment variables must be checked.
Install the plugin Set up the Go plugin for VSCode
1. Install the Go language plugin for VSCode
2. Install Git
When you start VSCode for the first time, you will be prompted to download it without hesitation (if there is no prompt, download it manually https://git-scm.com/download/win and select 64-bit Git for Windows Setup .)
3. Restart Git after installation
Restart VSCode and the output will show that Git is found
4. Install various extensions
click terminal
Then enter the following commands
go get -u -v github.com/nsf/gocode go get -u -v github.com/rogpeppe/godef go get -u -v github.com/golang/lint/golint go get -u -v github.com/lukehoban/go-find-references go get -u -v github.com/lukehoban/go-outline go get -u -v sourcegraph.com/sqs/goreturns go get -u -v golang.org/x/tools/cmd/gorename go get -u -v github.com/tpng/gopkgs go get -u -v github.com/newhook/go-symbols go get -u -v golang.org/x/tools/cmd/guru go get -u -v github.com/derekparker/delve/cmd/dlv
After it's all done, there are these files.
Debug Go code
1. Modify the go.root and go.path settings of VSCode
File -> Preferences -> Settings
Modify go.path and go.root respectively, then save
3. Debug
Open the last created helloworld folder
File -> Open Folder -> E:\GOPATH\src\helloworld
4. Add debugging configuration
Toggle debug configuration
Insert a breakpoint with F9 in main.go, then press F5 to debug