VSCode

Debug and Run with VSCode

Install the Extension

Create a .vscode/launch.json:

{
  "version": "0.2.0",
	"configurations": [
		{
			"name": "Launch file",
			"type": "go",
			"request": "launch",
			"mode": "debug",
			"port": 2345,
			"host": "127.0.0.1",
			"program": "${file}"
		},
		{
			"name": "Test Current File",
			"type": "go",
			"request": "launch",
			"mode": "test",
			"port": 2345,
			"host": "127.0.0.1",
			"program": "${file}",
			"env": {},
			"args": [],
			"showLog": true
		}
	]
}

Tip

Open the VsCode in you $GOPATH/src, not in the root of the $GOPATH.

Last updated

Was this helpful?