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

huangapple go评论77阅读模式
英文:

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

问题

我有远程开发的问题。我想请教一些解决这个问题的建议。

  1. 当我的代码在~/文件夹下时,调试无法停在断点处:
    vscode ssh develop Go cannot stop at breakpoint when code under /home/{username}/ floder

  2. 当我的代码不在~/文件夹下时,调试正常!
    vscode ssh develop Go cannot stop at breakpoint when code under /home/{username}/ floder

  3. 我尝试在~/文件夹下调试C文件,没有问题,可以停在断点处。


尝试过的方法:

  1. 我认为可能是权限的问题。所以我运行了sudo chmod 777 ~/code,但没有起作用。
英文:

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:
    vscode ssh develop Go cannot stop at breakpoint when code under /home/{username}/ floder

  2. when my code not under ~/ floder, debug normal!
    vscode ssh develop Go cannot stop at breakpoint when code under /home/{username}/ floder

  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.

答案1

得分: 1

请检查项目设置中是否没有符号链接,就像我在这里提到的那样。

对于Mac,请确保go env中不包含(如问题2807中所述)GOFLAGS="-trimpath"

解决方案是在launch.json中添加以下内容:

remotePath": "/myapp/"
英文:

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/"

答案2

得分: 0

感谢JetBrains-ssh-goland。我知道为什么我的远程Linux无法使用VSCode进行调试。

我的~路径是软链接到/data00路径。所以VSCode找不到~/下的文件。

但是goland可以找到它,我从goland复制的绝对路径如下:

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

我现在不知道软链接是什么,但我会找出来的 (╥﹏╥)
谢谢。

英文:

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:

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

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

huangapple
  • 本文由 发表于 2022年4月2日 17:09:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/71716222.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定