'vscode ssh develop Go cannot stop at breakpoint when code under /home/{username}/ floder

I have the remote develop problem. I want to ask for some advices to solve this problem.

  1. when my code under ~/ floder, debug cannot stop at breakpoints: case1-under home path

  2. when my code not under ~/ floder, debug normal! enter image description here

  3. I tried to debug C file under ~/ floder, no problem, can stop at breakpoint


Tried:

  1. I think if it is because of permission. so I run sudo chmod 777 ~/code, but not work.


Solution 1:[1]

Check if, as I mentioned here, there is no symlink in the project settings.

For mac, make sure go env does not include (as in issue 2807), GOFLAGS="-trimpath"

The solution would be to add to your launch.json

remotePath": "/myapp/"

Solution 2:[2]

thanks for JetBrains-ssh-goland. I know why my remote linux cannot debug using vscode.

my ~ path is soft link to /data00 path. so vscode cannot find file under ~/.

But goland can find it and the absolute path I copied from goland is below:

project path

I don't know what is soft link right now, but I will find it out (???) thanks.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 VonC
Solution 2 wangyk