- macOS Mojave 版本 10.14.6
- xcode-select version 2354
- go version go1.13.4 darwin/amd64
必要工具
1.xcode
通过 AppStore
安装
2.dlv
go get github.com/derekparker/delve/cmd/dlv
3.xcode-select
➜ workSpace git:(master) ✗ xcode-select --install
xcode-select: note: install requested for command line developer tools
配置启动
4.VSCode
菜单>调试>添加配置,编辑 launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "debug",
"remotePath": "",
"port": 2345,
"host": "127.0.0.1",
"program": "${fileDirname}",
"env": {
"GOPATH":"/Users/yourWorkSpace/.go"
},
"args": [],
"showLog": true
}
]
}
5.F5
启动调试
总结
到这里完成了 Golang
Web服务器调试配置 ,访问 http://localhost:3001/ 可进行预览