1.配置tasks.json
{
"version": "0.1.0",
"command": "go",
"isShellCommand": true,
"showOutput": "always",
"args": ["run","${file}"],
"isBuildCommand": true,
"taskSelector": "/t:"
}
2.配置launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "debug",
"type": "go",
"request": "launch",
"mode": "debug",
"remotePath": "",
"port": 8080,
"host": "127.0.0.1",
"program": "${workspaceRoot}/final.go",
"env": {},
"args": []
//"showLog": true
}
]
}
3.打开调试面板(ctrl+shit+d)
选择配置的调试“debug”
在调试控制台如果出现 API server listening at: 127.0.0.1:8080(这个是自己配置的地址和端口号)表示成功了
在浏览器中输入url,进入所打的断点