Cannot set breakpoints when there two files with the same

When using goland I am not able to set breakpoints when there are two files with the same names across the entire code base, including dependencies.

For example, I was testing OAuth2 using golang.org/x/oauth2 which has a file name oauth2.go. My own source also has a file with the same name.

After building the project and connecting to delve, when I try to set a breakpoint on my project's oauth2.go the breakpoint remains with an X and hovering the mouse it says: "could not find /home/user/source/test/oauth2.go:403"

Interestingly, there's no line 403 on the golang.org/x/oauth2 library oauth2.go file.

Is there any way to force goland to pass the full file path to delve when setting breakpoints?

0
5 comments

Please provide the OS name and version, Go version, IDE version / Go plugin version, the layout of the GOPATH, where the project is in GOPATH, if there are any symlinks used. Alteratively, please open an issue on the tracker, https://youtrack.jetbrains.com/issues/Go and attach the logs generated via Help | Collect and Show Logs in... Thank you

0
Avatar
Permanently deleted user

Florian,

I've investigated a bit further and the actual problem is the fact I am debugging remotely and my local source path is different from the source path from which the binaries have been built with. I've used Wireshark to see which was the path sent to delve.

GoLand is setting the breakpoint in /home/user/source/test/oauth2.go while the binary was built from /test/oauth2.go.
I tried to configure a remote server GoLand so that I could setup a directory mapping.
I was hoping this would be sufficient but it didn't work, GoLand is still sending the local path to the debugger.

Any thoughts?

0

Hi Ricfand, thanks for the update.

Unfortunately this still doesn't provide me with any information on how to reproduce the issue.

GoLand has automatic source code mapping built in, and I can explain to you to set the logging so that you can get the full communication between the IDE and the remote delve instance, but I still need to have a way to see actual paths that can allow me to investigate the issue further.

To get the extended delve logs, please go to Help | Debug Log Settings... and add "#com.goide.dlv.DlvVm" (without the quotes), then try again. Once the problem is reproduced, please go to the same place and remove the line you just added, then go to Help | Collect and Show Logs in... and upload the logs to the issue https://youtrack.jetbrains.com/issue/GO-3988, or open a new one.

Thank you.

0
Avatar
Permanently deleted user

Florian,

Would you mind to point me to the documentation on how to setup automatic source code mapping?

0

Hi Ricfand, the logic is built in the IDE itself, there is nothing to setup as a user, which is why more details are needed, to understand what the IDE sees and why it's not working as expected.

0

Please sign in to leave a comment.