Skip to content

Paths don't resolve when compiling using prerelease 2025-09-04 build #3877

@joel-rieke

Description

@joel-rieke

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.25.1 linux/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    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.25.1

  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    1.104.1
    0f0d87fa9e96c856c5212fc86db137ac0d783365
    x64
  • Check your installed extensions to get the version of the VS Code Go extension
    Identifier
    golang.go
    Version
    0.51.0
    Last Updated
    2025-09-21, 18:49:25
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.

Environment

GOBIN: undefined
toolsGopath:
gopath: /home//go
GOROOT: /usr/local/go
PATH:

Tools

go:	/usr/local/go/bin/go: go version go1.25.1 linux/amd64

gopls:	/home/<redacted>/go/bin/gopls	(version: v0.20.0 built with go: go1.25.1)
gotests:	/home/<redacted>/go/bin/gotests	(version: v1.6.0 built with go: go1.25.1)
impl:	/home/<redacted>/go/bin/impl	(version: v1.4.0 built with go: go1.25.1)
goplay:	/home/<redacted>/go/bin/goplay	(version: v1.0.0 built with go: go1.25.1)
dlv:	/home/<redacted>/go/bin/dlv	(version: v1.25.2 built with go: go1.25.1)

Go env

Workspace Folder: /home//a

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/<redacted>/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/<redacted>/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=<redacted>
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build612358525=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='<redacted>'
GOMODCACHE='/home/<redacted>/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/<redacted>/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/<redacted>/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.25.1'
GOWORK=''
PKG_CONFIG='pkg-config'

Workspace Folder: /home//b

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/<redacted>/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/<redacted>/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS='<redacted>'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1731296672=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='<redacted>/go.mod'
GOMODCACHE='/home/<redacted>/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/<redacted>/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/<redacted>/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.25.1'
GOWORK='<redacted>'
PKG_CONFIG='pkg-config'

Workspace Folder: /home//c

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

I have a project of projects I'm trying to debug a program for. Let's assume the following layout

myWorkspace
a
.vcsode/launch.json
mypackage/myapp.go
b
.vcsode/launch.json
apppackage2/myapp.go
c
cpackage/cpackage.go

I'd like to debug mypackage/myapp.go. So I make the appropriate standard program based go debug configuration in my launch.json under a. For fun, I make a us a function from project c cpackage.

When I debug the 1st time, assuming there are no errors, it runs perfectly. However, if I put some kind of compilation error in cpackage.go and press f5 to compile/debug, I get the expected compilation errors, but all the paths are warping to never neverland... In this case, they would look like

../../c/cpackage/cpackage.go:15:7 (Compilation error).

Since the workspace is rooted at myWorkspace however, when I click on the link to ../../c/cpackage/cpackage.go, it takes me to never never land. with the error, "The editor could not be opened because the file was not found".

Workaround (painful when you have a lot of broken lines of code):
Open terminal, Carefully copy c/cpackage/cpackage.go from the "Debug Terminal" and type:

code c/cpackage/cpackage.go

I'm not sure if this is a bug or a feature request (so appologies if this should be a feature request), but I'd really really like it to work if at all possible?

I've tried numerous things to work around the issue, but it looks like I'd have to take over compilation to fix this problem and I'd rather not do that since it would be yet another thing to maintain outside of the code repo (I'd have to create a preLaunch task and a custom builder).

Changing cwd and numerous other launch attributes in the launch.json also has no effect. It always prefixes the ../../... etc... I even tried symlinks to just make it happy (not maintainable for sure!) I even considered writing my own vscode plugin to just strip off any number of ../../.., but that would have only affected the delve integration which doesn't really help.

substitutePath only affects the delve integration, which is great for runtime panics, but compilation happens before we interact with delve.

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