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.23.6 linux/amd64
- Run
gopls -v version to get version of Gopls from the VS Code integrated terminal.
- golang.org/x/tools/gopls v0.18.1
- Run
code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
- 1.100.2 MacOS M3 running over SSH on Linux Fedora 42
- Check your installed extensions to get the version of the VS Code Go extension
- Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
Go: Locate Configured Go Tools command.
# Tools Configuration
## Environment
GOBIN: undefined
toolsGopath:
gopath: /home/lzap/go
GOROOT: /home/lzap/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.7.linux-amd64
PATH: /home/lzap/.vscode-server/cli/servers/Stable-848b80aeb52026648a8ff9f7c45a9b0a80641e2e/server/bin/remote-cli:/home/lzap/go/bin:/home/lzap/go/bin:/home/lzap/.local/bin:/home/lzap/bin:/usr/local/bin:/usr/bin:/usr/sbin
## Tools
go: /home/lzap/bin/go: go version go1.23.7 linux/amd64
gopls: /home/lzap/go/bin/gopls (version: v0.18.1 built with go: go1.23.6)
gotests: /home/lzap/go/bin/gotests (version: v1.6.0 built with go: go1.23.6)
gomodifytags: /home/lzap/go/bin/gomodifytags (version: v1.17.0 built with go: go1.23.6)
impl: /home/lzap/go/bin/impl (version: v1.4.0 built with go: go1.23.6)
goplay: /home/lzap/go/bin/goplay (version: v1.0.0 built with go: go1.23.6)
dlv: /home/lzap/go/bin/dlv (version: v1.24.1 built with go: go1.23.6)
staticcheck: /home/lzap/go/bin/staticcheck (version: v0.6.1 built with go: go1.23.6)
## Go env
Workspace Folder (blueprint-schema): /home/lzap/blueprint-schema
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/lzap/.cache/go-build'
GOENV='/home/lzap/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/lzap/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/lzap/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/lzap/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.7.linux-amd64'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/lzap/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.7.linux-amd64/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.7'
GODEBUG=''
GOTELEMETRY='on'
GOTELEMETRYDIR='/home/lzap/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/lzap/blueprint-schema/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3873653729=/tmp/go-build -gno-record-gcc-switches'
Share the Go related settings you have added/edited
"go.toolsManagement.autoUpdate": true,
"go.coverOnTestPackage": false,
"go.testFlags": [
"-v"
],
Describe the bug
Hello, I have the following launch config:
{
"version": "0.2.0",
"configurations": [
{
"name": "Service",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "cmd/controller",
"cwd": "${workspaceFolder}"
}
]
}
Now, when I launch it Delve changes directory into cmd/controller and builds . and then all compilation errors have a relative path from this directory. For example:
Starting: /home/lzap/go/bin/dlv dap --listen=127.0.0.1:41945 --log-dest=3 from /home/lzap/forester/cmd/controller
DAP server listening at: 127.0.0.1:41945
Build Error: go build -o /home/lzap/forester/cmd/controller/__debug_bin3829863487 -gcflags all=-N -l .
# forester/internal/config
../../internal/config/config.go:121:37: undefined: Hostname (exit status 1)
When I click on ../../internal/config/config.go:121:37 VSCode is unable to locate this file as it tries to find it two levels above the project directory. It thinks this is relative to the project root directory instead. Thanks.
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
go versionto get version of Go from the VS Code integrated terminal.gopls -v versionto get version of Gopls from the VS Code integrated terminal.code -vorcode-insiders -vto get version of VS Code or VS Code Insiders.Go: Locate Configured Go Toolscommand.Share the Go related settings you have added/edited
Describe the bug
Hello, I have the following launch config:
{ "version": "0.2.0", "configurations": [ { "name": "Service", "type": "go", "request": "launch", "mode": "auto", "program": "cmd/controller", "cwd": "${workspaceFolder}" } ] }Now, when I launch it Delve changes directory into cmd/controller and builds
.and then all compilation errors have a relative path from this directory. For example:When I click on
../../internal/config/config.go:121:37VSCode is unable to locate this file as it tries to find it two levels above the project directory. It thinks this is relative to the project root directory instead. Thanks.