Visual Studio Code + delve
Here, I will use the Visual Studio Code, which is forked from Atom Editor. With the Visual Studio Code, you can use delve as GUI debugger and you can use Visual Studio Code on any platform.Procedure
- install Visual Studio Code(VsCode)
- install VsCode plugin Go
- install other tools for plugin Go : Microsoft/vscode-go: > tools
- set PATH and GOPATH
- write the launch.json
- write the settings.json
- Open cmd/geth folder from VsCode
- Press F5, Run debugger
Install Visual Studio Code
First we need the Visual Studio Code, you can download and install it here. it's easy to install, so I do not explain much here.install Visual Studio Code plugin Go
After the Visual Studio Code is installed, then, install the plugin named 'Go' (see the bleow image)
Install other tools for plugin Go
plugin Go needs some other tools to analyze the .go files. you can see the tools list and how to install at the below page.
PATH and GOPATH
The ehtereum uses "godep go install" to compile. As for delve, you can't use godep, so you should set GOPATH by yourself.On Linux, I tried the set GOPATH variable through .vscode/launch.json, but it was not possible to set several path at once using ':'. Thus, I should set it on .bashrc
GOPATH=/home/username/go/ethereum:/home/username/go/ethereum/src/github.com/ethereum/go-ethereum/Godeps/_workspace
launch.json
Press F5, then .vscode/launch.json will be showed up. You can edit it with the below codes.{ "version": "0.2.0", "configurations": [ { "name": "Launch", "type": "go", "request": "launch", "mode": "debug", "program": "${workspaceRoot}", "env": { }, "args": [] } ] }
Options, settings.json
You can adjust the option values of the Go plugin with writing the .vscode/settings.json
However, I do not think the below keys are working properly
- go.goroot
- go.gopath
{ "go.buildOnSave": true, "go.lintOnSave": true, "go.vetOnSave": true, "go.buildTags": "", "go.buildFlags": [], "go.lintFlags": [], "go.vetFlags": [], "go.coverOnSave": false, "go.useCodeSnippetsOnFunctionSuggest": false, "go.formatOnSave": true, "go.formatTool": "goreturns", "go.goroot": "d:/Go", "go.gopath": "d:/mine/programming/go/ethereum", "go.gocodeAutoBuild": false }
open cmd/geth
On Visual Studio Code, You should open the "cmd/geth" directory to compile with delve debuggerFile ---> Open Folder ---> <ethereum_root>/cmd/geth
댓글 없음:
댓글 쓰기