-
Notifications
You must be signed in to change notification settings - Fork 728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
debug: "outside available modules" when use auto mode to debug at remote development #1677
Comments
go env |
@Seumi are you using symlink? It looks like the go command |
Thanks for your reply! @hyangah |
It is a problem in my environment. The system image has a symlink, /home/xxx ->/data00/home/xxx, and the go tool chain doesn't seem to recognize it😢 |
Change https://golang.org/cl/346095 mentions this issue: |
When the current build directory is resolved to a path different from the program's directory due to soft/symbolic links, the go command can be confused and complain that the absolute path in program is outside the module of the current directory. This CL avoids such problem by making dlv always use a relative path as the build target for build/test mode (and auto for testing). Before starting the debug session, we massage the launch config: program: /foo/bar.go -> program: ./bar.go, __buildDir: /foo program: /foo/bar -> program: ., __buildDir: /foo/bar Previously we find the package directory just before spawning dlv dap and spawn the dlv dap process from the package directory. With this CL, we find the package directory when resolving the debug configuration before debug session. This introduces __buildDir attribute which is internal. (There is an ongoing work to introduce 'buildDir' to dlv DAP so we use internal attribute to make it clear.) Also, this made the resolveDebugConfigurationWithSubstitutedVariables accept relative paths without workspace root. Just the behavior is undefined. (The motivation of change in this part is the testing. We have 'output' property or some others, that are like relative path. I guess most users wouldn't care much. Delve is cool with relative paths so we do our best to resolve that wrt the workspace root. Otherwise, just let delve decide. Fixes #1713 Fixes #1680 Fixes #1677 Updates #1348 Change-Id: I434c43131b27d9c58058450c502e1b30c58ea690 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/344790 Trust: Hyang-Ah Hana Kim <hyangah@gmail.com> Trust: Suzy Mueller <suzmue@golang.org> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Suzy Mueller <suzmue@golang.org> Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/346095
v0.27.2 was released and it should fix the issue. Please reopen this issue or comment otherwise. Thanks! |
Change https://golang.org/cl/351272 mentions this issue: |
As a fix for #1677, the extension massages launch configurations to start dlv from the package directory and locate 'program' to be relative from the package directory. This heuristic does not work well if dlv dap adapter is launched externally so dlv runs from other directory. Until `delveCWD` or a similar mechanism that allows to control where delve runs the build, we take the launch configuration verbatim and avoid any mutation. Relative paths are resolved as described in the descriptions in package.json. This changes only the internal mechanics. Fixes #1793 Change-Id: Ic651be25a692dbb23a51707d5ebc274f22a3c532 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/351272 Trust: Hyang-Ah Hana Kim <hyangah@gmail.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Polina Sokolova <polina@google.com>
Change https://golang.org/cl/351570 mentions this issue: |
…al adapter As a fix for #1677, the extension massages launch configurations to start dlv from the package directory and locate 'program' to be relative from the package directory. This heuristic does not work well if dlv dap adapter is launched externally so dlv runs from other directory. Until `delveCWD` or a similar mechanism that allows to control where delve runs the build, we take the launch configuration verbatim and avoid any mutation. Relative paths are resolved as described in the descriptions in package.json. This changes only the internal mechanics. Fixes #1793 Change-Id: Ic651be25a692dbb23a51707d5ebc274f22a3c532 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/351272 Trust: Hyang-Ah Hana Kim <hyangah@gmail.com> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Polina Sokolova <polina@google.com> (cherry picked from commit cfee3e1) Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/351570 Reviewed-by: Robert Findley <rfindley@google.com>
For asking questions, see:
#vscode
channel in Gophers SlackBefore filing an issue, please review our troubleshooting guides
Please answer these questions before submitting your issue. Thanks!
What version of Go, VS Code & VS Code Go extension are you using?
go version
to get version of Go from the VS Code integrated terminal.gopls -v version
to get version of Gopls from the VS Code integrated terminal.golang.org/x/tools/gopls v0.7.1
golang.org/x/tools/gopls@v0.7.1 h1:Mh3Z8Xcoq3Zy7ksSlwDV/nzQSbjFf06A+L+F8YHq55U=
github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/google/go-cmp@v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
golang.org/x/mod@v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
golang.org/x/sys@v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
golang.org/x/tools@v0.1.6-0.20210802203754-9b21a8868e16 h1:ZC/gVBZl8poJyKzWLxxlsmhayVGosF4mohR35szD5Bg=
golang.org/x/xerrors@v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
honnef.co/go/tools@v0.2.0 h1:ws8AfbgTX3oIczLPNPCu5166oBg9ST2vNs0rcht+mDE=
mvdan.cc/gofumpt@v0.1.1 h1:bi/1aS/5W00E2ny5q65w9SnKpWEF/UIOqDYBILpo9rA=
mvdan.cc/xurls/v2@v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=
code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.379476f0e13988d90fab105c5c19e7abc8b1dea8
x64
Go: Locate Configured Go Tools
command.Share the Go related settings you have added/edited
Run
Preferences: Open Settings (JSON)
command to open your settings.json file.Share all the settings with the
go.
or["go"]
orgopls
prefixes.Describe the bug
When I use go mod init to initialize a module and write a simple main.go file, set a breakpoint at will, and then press F5 to start debugging. The console output:
Starting: /home/xxx/go/bin/dlv-dap dap --listen=127.0.0.1:11031 --log=true --log-dest=3
DAP server listening at: 127.0.0.1:11031
Build Error: go build -o /data00/home/xxx/go/src/xxx/tdebug/__debug_bin -gcflags all=-N -l /home/xx/go/src/xxx/tdebug
directory /home/xxx/go/src/xxx/tdebug outside available modules (exit status 1).
But when i execute this command manually(go build -o .....), the execution was successful and the file "__debug_bin" was generated.
Then i change the mode from "auto" to "exec" and specify the path of "__debug_bin", the debugging can start.
Steps to reproduce the behavior:
Screenshots or recordings
The text was updated successfully, but these errors were encountered: