Skip to content

debug: "outside available modules" when use auto mode to debug at remote development #1677

@Seumi

Description

@Seumi

For asking questions, see:

Before 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?

  • Run go version to get version of Go from the VS Code integrated terminal.
    • go version go1.16.7 linux/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    • 1.59.0
      379476f0e13988d90fab105c5c19e7abc8b1dea8
      x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.27.0
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > 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"] or gopls 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:

  1. mkdir tdebug && cd tdebug
  2. go mod init tdebug
  3. write a main.go just contains print "hello world" and make a breakpoint
  4. F5 to start debug
  5. the error occurred

Screenshots or recordings

screenshot-20210810-214028

Metadata

Metadata

Assignees

No one assigned

    Labels

    DebugIssues related to the debugging functionality of the extension.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions