vscode-go
vscode-go copied to clipboard
Filenames in launch output build errors are not clickable
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
- Run
go versionto get version of Go from the VS Code integrated terminal.go version go1.19.2 linux/amd64
- Run
gopls -v versionto get version of Gopls from the VS Code integrated terminal.golang.org/x/tools/gopls v0.11.0
- Run
code -vorcode-insiders -vto get version of VS Code or VS Code Insiders.1.74.397dec172d3256f8ca4bfb2143f3f76b503ca0534
- Check your installed extensions to get the version of the VS Code Go extension
v0.37.1
- Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
Go: Locate Configured Go Toolscommand.
gotests: not installed
gomodifytags: not installed
impl: not installed
goplay: not installed
dlv: /go/bin/dlv (version: v1.20.1 built with go: go1.19.2)
golangci-lint: /go/bin/golangci-lint (version: v1.50.1 built with go: go1.19.2)
gopls: /go/bin/gopls (version: v0.11.0 built with go: go1.19.2)
Describe the bug
When starting a debug session fails due to go build errors, VS Code can't open the file paths printed.
This is because the paths are relative to the built package, and not the workspace root as VS Code expects.
Steps to reproduce the behavior:
- Add a Go launch configuration
- Break compilation
- Launch a debug session
- Ctrl-Click a path in the
go buildoutput
@hyangah is there precedent for this type of path sanitization? What about making the errors clickable by recognizing relative paths: is that within our control?
Yes, unfortunately, that's a well known issue.
I think we can either utilize this coming feature (-fullpath) https://github.com/golang/go/issues/37708 and its extension (to apply the same to compile in addition to test).
Or, an alternative is to utilize the VS Code tasks to build the binary. I just did a quick testing and it seems to recognize relative paths well. (related: https://github.com/golang/vscode-go/issues/194)
cc @golang/tools-team
(I think your cc didn't work)
I confirm the issue. Bug is not fixed on latest version of go extension
The most viable solution is for https://github.com/golang/go/issues/60451 to be completed, which would add -fullpath to go build. That is an accepted proposal so it just needs someone to implement it.