I am trying to debug Go app. Launch config works fine, but seems dlv
picking up random port every time debugger starts, which I can see from my logs in console the port is "0"(which means random one):
2021/12/23 15:16:57 Serving on port: 0
Compare to running without debugger:
2021/12/23 15:17:23 Serving on port: 8080
When I type in terminal lsof -i tcp
I see the following, the port is random everytime:
__debug_b 19909 userName 7u IPv6 0xd6d310c29592c12f 0t0 TCP *:60179 (LISTEN)
launch.json config:
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "cmd/main.go",
"showLog": true,
"verboseDiagnosticLogging": true,
}
specifying "port"
in config doesn't work for me.
Can I somehow configure debugger to pick up a specific port, 8080
in my case?