以 root 身份运行 delve 时获取 vcs 状态时出错

doe*_*che 10 git debugging go delve

我尝试sudo dlv debug在 Arch Linux 上运行,但不断收到以下错误:

error obtaining VCS status: exit status 128
    Use -buildvcs=false to disable VCS stamping.
exit status 1
Run Code Online (Sandbox Code Playgroud)

当我删除 .git 文件夹时,sudo dlv debug它按预期运行,所以我认为这可能是 git 的配置问题?!

Mes*_*esh 18

当通过 vscode 调试在远程容器中打开的代码时,我遇到了类似的错误消息。

当我使用时,git status我收到一条消息,说 git 存储库不安全,由其他人拥有。然后是一条解释使用的消息:

git config --global --add safe.directory [your dir here]
Run Code Online (Sandbox Code Playgroud)

这样做我不再收到 VCS 标记警告