Thanks to visit codestin.com
Credit goes to github.com

Skip to content

debug: either handle symlinks, or put a warning in front of the user #3860

@mpictor

Description

@mpictor

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.
    • go version go1.24.2 linux/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • below
      ⚠️ naively pasting this data seems to break github markdown
Build info
----------
golang.org/x/tools/gopls v0.20.0
    golang.org/x/tools/[email protected] h1:fxOYZXKl6IsOTKIh6IgjDbIDHlr5btOtOUkrGOgFDB4=
    github.com/BurntSushi/[email protected] h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
    github.com/fatih/[email protected] h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8=
    github.com/fatih/[email protected] h1:dDSgAjoOMp8da3egfz0t2S+t8RGOpEmEXZubcGuc0Bg=
    github.com/fatih/[email protected] h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
    github.com/fsnotify/[email protected] h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
    github.com/google/[email protected] h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
    golang.org/x/exp/[email protected] h1:KdrhdYPDUvJTvrDK9gdjfFd6JTk8vA1WJoldYSi0kHo=
    golang.org/x/[email protected] h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg=
    golang.org/x/[email protected] h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
    golang.org/x/[email protected] h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
    golang.org/x/[email protected] h1:DU+gwOBXU+6bO0sEyO7o/NeMlxZxCZEvI7v+J4a1zRQ=
    golang.org/x/[email protected] h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
    golang.org/x/[email protected] h1:ZRKyKRJl/YEWl9ScZwd6Ua6xSt7DE6tHp1I3ucMroGM=
    golang.org/x/[email protected] h1:Ju8QsuyhX3Hk8ma3CesTbO8vfJD9EvUBgHvkxHBzj0I=
    honnef.co/go/[email protected] h1:fj8r9irJSpolAGUdZBxJIRY3lLc4jH2Dt4lwnWyWwpw=
    mvdan.cc/[email protected] h1:nZUCeC2ViFaerTcYKstMmfysj6uhQrA2vJe+2vwGU6k=
    mvdan.cc/xurls/[email protected] h1:3NTZpeTxYVWNSokW3MKeyVkz/j7uYXYiMtXRUfmjbgI=
go: go1.24.2
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    • 1.103.2
    • 6f17636121051a53c88d3e605c491d22af2ba755
    • x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • Identifier golang.go
    • Version 0.50.0
    • Last Updated 2025-09-06, 17:12:22
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
# Tools Configuration


## Environment

GOBIN: undefined
toolsGopath: 
gopath: $HOME/go
GOROOT: $HOME/sdk/golatest
PATH: $HOME/sdk/golatest/bin:~/bin:~/.local/bin:~/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/bin:/usr/lib/llvm/20/bin:$HOME/go/bin
PATH (vscode launched with): ~/bin:~/.local/bin:~/.cargo/bin:$HOME/sdk/golatest/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/bin:/usr/lib/llvm/20/bin:$HOME/go/bin

## Tools

	go:	$HOME/sdk/golatest/bin/go: go version go1.24.2 linux/amd64

	gopls:	$HOME/go/bin/gopls	(version: v0.20.0 built with go: go1.24.2)
	gotests:	$HOME/go/bin/gotests	(version: v1.6.0 built with go: go1.24.2)
	impl:	$HOME/go/bin/impl	(version: v1.4.0 built with go: go1.24.2)
	goplay:	$HOME/go/bin/goplay	(version: v1.0.0 built with go: go1.24.2)
	dlv:	$HOME/go/bin/dlv	(version: v1.25.2 built with go: go1.24.2)
	staticcheck:	$HOME/go/bin/staticcheck	(version: v0.6.1 built with go: go1.24.2)

## Go env

Workspace Folder (myproject): /path/to/myproject

	AR='ar'
	CC='gcc'
	CGO_CFLAGS='-O2 -g'
	CGO_CPPFLAGS=''
	CGO_CXXFLAGS='-O2 -g'
	CGO_ENABLED='1'
	CGO_FFLAGS='-O2 -g'
	CGO_LDFLAGS='-O2 -g'
	CXX='g++'
	GCCGO='gccgo'
	GO111MODULE=''
	GOAMD64='v1'
	GOARCH='amd64'
	GOAUTH='netrc'
	GOBIN=''
	GOCACHE='$HOME/.cache/go-build'
	GOCACHEPROG=''
	GODEBUG=''
	GOENV='$HOME/.config/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFIPS140='off'
	GOFLAGS=''
	GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4180131799=/tmp/go-build -gno-record-gcc-switches'
	GOHOSTARCH='amd64'
	GOHOSTOS='linux'
	GOINSECURE=''
	GOMOD='/path/to/myproject/go.mod'
	GOMODCACHE='$HOME/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='linux'
	GOPATH='$HOME/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='$HOME/sdk/golatest'
	GOSUMDB='sum.golang.org'
	GOTELEMETRY='local'
	GOTELEMETRYDIR='$HOME/.config/go/telemetry'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='$HOME/sdk/golatest/pkg/tool/linux_amd64'
	GOVCS=''
	GOVERSION='go1.24.2'
	GOWORK=''
	PKG_CONFIG='pkg-config'

Share the Go related settings you have added/edited

N/A

Describe the bug

If I add a folder to the workspace where the path contains a symlink, debugging go code within the folder fails with no explaination as to why.

The code didn't crash, so delve simply exited; it appeared to me that breakpoints were not being communicated to delve. I'm guessing they actually were sent, but were never hit due to a path mismatch.

This was particularly confusing because a few hours earlier I'd successfully set and used breakpoints in another project; since I hadn't updated anything or restarted vscode it seemed very unlikely that anything had changed. Because I could run delve from the command line, create a breakpoint on one of my functions, and stop on it, my belief that vscode was broken was reinforced.

I updated vscode-go, gopls, and delve, all to no avail; vscode was already the latest version. While I found some errors and warnings in logs, it was unclear whether they were meaningful or something that the vscode and/or vscode-go devs deemed inconsequential and thus low priority.

Such errors include these, reported under Extension Host:

2025-09-06 17:16:00.204 [error] Error: Invalid debug adapter
    at Cqt.p (vscode-file://vscode-app/opt/vscode/resources/app/out/vs/workbench/workbench.desktop.main.js:525:100)
    at Cqt.$acceptDAMessage (vscode-file://vscode-app/opt/vscode/resources/app/out/vs/workbench/workbench.desktop.main.js:524:33460)
    at MDt.S (vscode-file://vscode-app/opt/vscode/resources/app/out/vs/workbench/workbench.desktop.main.js:3642:40383)
    at MDt.Q (vscode-file://vscode-app/opt/vscode/resources/app/out/vs/workbench/workbench.desktop.main.js:3642:40161)
    at MDt.M (vscode-file://vscode-app/opt/vscode/resources/app/out/vs/workbench/workbench.desktop.main.js:3642:39249)
    at MDt.L (vscode-file://vscode-app/opt/vscode/resources/app/out/vs/workbench/workbench.desktop.main.js:3642:38350)
    at yae.value (vscode-file://vscode-app/opt/vscode/resources/app/out/vs/workbench/workbench.desktop.main.js:3642:37142)
    at I.C (vscode-file://vscode-app/opt/vscode/resources/app/out/vs/workbench/workbench.desktop.main.js:29:2392)
    at I.fire (vscode-file://vscode-app/opt/vscode/resources/app/out/vs/workbench/workbench.desktop.main.js:29:2611)
    at i3.fire (vscode-file://vscode-app/opt/vscode/resources/app/out/vs/workbench/workbench.desktop.main.js:550:10349)

and

2025-09-06 17:21:34.310 [error] [golang.go] provider FAILED
2025-09-06 17:21:34.310 [error] Error: context canceled
    at handleResponse (/$HOME/.vscode/extensions/golang.go-0.50.0/dist/goMain.js:8582:40)
    at handleMessage (/$HOME/.vscode/extensions/golang.go-0.50.0/dist/goMain.js:8392:11)
    at processMessageQueue (/$HOME/.vscode/extensions/golang.go-0.50.0/dist/goMain.js:8407:13)
    at Immediate.<anonymous> (/$HOME/.vscode/extensions/golang.go-0.50.0/dist/goMain.js:8383:11)
    at processImmediate (node:internal/timers:485:21)

Unresolved bug reports can be found mentioning at least one of the above, and it's completely unclear whether the message is meaningful.

Please either seamlessly support symlinks or provide a warning/error that I can find and that actually mentions symlinks. It seems to me that all that's needed is to get the package directory, evaluate symlinks, and compare the result with the original. If it differs, a symlink is involved and may interfere.

Also, if the above errors are inconsequential, please clean them up.

My biggest frustration with vscode is, when things go wrong, trying to determine where the problem lies. This is often fruitless; the level of effort is far, far too high. For one example of the effort, the numerous things I must do to get all the requested info at the beginning of this bug report, as well as having to scrub it as it contained things I don't wish to share.

Steps to reproduce the behavior:

  1. may be necessary to test on linux; haven't tried others
  2. put some go code a couple directory levels deep; choose something with test(s)
  3. create a symlink to one of the dirs
  4. add folder to workspace, navigating through the symlink to the go code dir
  5. put a breakpoint in a test and click debug test
  6. output indicates delve ran the test and the test completed (when instead it should have stopped on the breakpoint)
Starting: $HOME/go/bin/dlv dap --listen=127.0.0.1:42543 --log-dest=3 from /path/to/myproject
DAP server listening at: 127.0.0.1:42543
Type 'dlv help' for list of commands.
--- FAIL: TestMyTest (0.00s)
      my_test.go:227: bad checksum ff
FAIL
Process 117371 has exited with status 1
Detaching

If I remove the folder from the workspace and re-add using the "real" path, the breakpoint works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions