Reputation: 1020
I'm attempting to debug a single-file Go application running in a docker container, using delve in the container, and using GoLand on a Mac laptop.
When I run a local debugger, my breakpoints work. When I use a "Go Remote" configuration, all of my breakpoints become a circle-slash, and the note says "could not find FILENAME".
I verified that my source files are at the same relative path to the GOPATH on both the server (container) and client.
I'm using Go 1.12.5 in the container, with this delve command:
dlv debug --headless --listen=:8044 --api-version=2 --accept-multiclient
It correctly builds my src/github.com/flinkt/reverseProxy/reverseProxy.go
to bin/reverseProxy
and begins outputting the expected messages when it gets the http requests it expects.
My GoLand build is 2019.1. The config hits localhost 8043, and has no other fields filled-in.
The docker container is mounting the source through, so I'm sure that they are looking at the exact same source files.
The project config has a content root right above the src/
and bin/
directories, and that is set as the project GOPATH too. There is no global GOPATH, and all dependencies are in the src/
tree. The checkbox to index everything is checked.
Suggestions on why my IDE can't see my source or stop at my breakpoints?
Upvotes: 3
Views: 3865
Reputation: 121
I encounter a similar situation as you.
Here is my scenario:
dlv --listen=:2345 --headless=true --api-version=2 --accept-multiclient attach $PID
Solution:
Enable "Go Modules integration" at Goland settings, and it works!
Perhaps I use Go Module while building, and Goland implements delve client by themselves, so I should enable Goland Go Module integration to let Goland treat source code path correctly.
Goland: 2019.1.3, delve: 1.2.0, Go: 1.12.4
Hope this will help you.
Upvotes: 2