Skip to content
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

Impossible to define delve output folder in settings #3576

Open
fbaligand opened this issue Oct 22, 2024 · 2 comments
Open

Impossible to define delve output folder in settings #3576

fbaligand opened this issue Oct 22, 2024 · 2 comments
Labels
Debug Issues related to the debugging functionality of the extension. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@fbaligand
Copy link

What version of Go, VS Code & VS Code Go extension are you using?

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.
    • go1.23.2 windows/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • golang.org/x/tools/gopls v0.16.2
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    • 1.94.2
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.42.1
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.

Tools Configuration

Environment

GOBIN: undefined
toolsGopath:
gopath: F:\go\packages
GOROOT: F:\go\go-1.23.2
PATH (vscode launched with): ...;F:\go\go-1.23.2\bin;F:\go\packages\bin

Tools

go:	F:\go\go-1.23.2\bin\go.exe: go version go1.23.2 windows/amd64

gopls:	F:\go\packages\bin\gopls.exe	(version: v0.16.2 built with go: go1.23.2)
gotests:	F:\go\packages\bin\gotests.exe	(version: v1.6.0 built with go: go1.23.2)
gomodifytags:	not installed
impl:	not installed
goplay:	not installed
dlv:	F:\go\packages\bin\dlv.exe	(version: v1.23.1 built with go: go1.23.2)
staticcheck:	F:\go\packages\bin\staticcheck.exe	(version: v0.5.1 built with go: go1.23.2)

Go env

Workspace Folder (formation-go): c:\Local\workspaces\workspaceGo\formation-go

set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\baligand\AppData\Local\go-build
set GOENV=C:\Users\baligand\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=F:\go\packages\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=F:\go\packages
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=F:\go\go-1.23.2
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=F:\go\go-1.23.2\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.23.2
set GODEBUG=
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\baligand\AppData\Roaming\go\telemetry
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=NUL
set GOWORK=c:\Local\workspaces\workspaceGo\formation-go\go.work
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Temp\go-build946205592=/tmp/go-build -gno-record-gcc-switches

Share the Go related settings you have added/edited

{
    "go.delveConfig": {
        "output": "C:\\Temp"
    }
}

Describe the bug

A clear and concise description of what the bug.
Even if I define "go.delveConfig.output" setting (given this documentation), the binary (.exe) generated by delve is still in my "main.go" directory (instead of "C:\Temp").

A clear and concise description of what you expected to happen.
I expect that binary generated by delve (ex: __debug_bin4271654450.exe) is generated in "C:\Temp" directory, and not in my "main.go" directory.

Steps to reproduce the behavior:

  1. Put this into vscode "settings.json":
{
    "go.delveConfig": {
        "output": "C:\\Temp"
    }
}
  1. Open a "main.go" file
  2. Click on 'Run' menu, then "Run Without Debugging"
  3. See that "__debug_bin.exe" is generated into "main.go" directory, (instead of "C:\Temp")
@gopherbot gopherbot added this to the Untriaged milestone Oct 22, 2024
@findleyr findleyr added Debug Issues related to the debugging functionality of the extension. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Oct 24, 2024
@findleyr
Copy link
Contributor

CC @h9jiang

@findleyr findleyr modified the milestones: Untriaged, vscode-go/backlog Oct 31, 2024
@h9jiang
Copy link
Member

h9jiang commented Oct 31, 2024

Based on my investigation on this issue, I believe this is WAI. But we can consider making it feature request to make it available as well.

  • The vscode-go wiki stated that only configuration debugAdapter showGlobalVariables substitutePath is accepted by the go.DelveConfig. So if you want to set this configuration, you can do it by setting in launch.json. Follow instructions in wiki.
  • I realized that the output configuration supported by dlv is the file path to the executable, but the example you provided is a directory. The dlv will try to delete the file specified by the output, create the executable and delete the executable afterwards. So instead, you can try "output": "C:\\Temp\debugee".
  • If you want to set the set the output debugee in a folder, please consider file a FR to https://github.com/go-delve/delve.

We can turn this into a FR if delve support writing debugee to folder.

Note: if you decided to add the output in launch.json, the configuration will not be picked up when you choose to run a debug session without the launch configuration. See wiki

@h9jiang h9jiang added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Debug Issues related to the debugging functionality of the extension. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants