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_. Build info ---------- golang.org/x/tools/gopls v0.19.0-pre.2 golang.org/x/tools/gopls@v0.19.0-pre.2 h1:CUjqNCFGKHPMRZMd/tkBvtkae+eJuGNHOYsGpKxQNj4= github.com/BurntSushi/toml@v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs= github.com/fatih/camelcase@v1.0.0 h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8= github.com/fatih/gomodifytags@v1.17.1-0.20250423142747-f3939df9aa3c h1:dDSgAjoOMp8da3egfz0t2S+t8RGOpEmEXZubcGuc0Bg= github.com/fatih/structtag@v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/google/go-cmp@v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= golang.org/x/exp/typeparams@v0.0.0-20250218142911-aa4b98e5adaa h1:Br3+0EZZohShrmVVc85znGpxw7Ca8hsUJlrdT/JQGw8= golang.org/x/mod@v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= golang.org/x/sync@v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= golang.org/x/telemetry@v0.0.0-20250417124945-06ef541f3fa3 h1:RXY2+rSHXvxO2Y+gKrPjYVaEoGOqh3VEXFhnWAt1Irg= golang.org/x/text@v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= golang.org/x/tools@v0.33.1-0.20250604180551-4d89d8aef849 h1:y+3SPx7RmIoU/DCRF+k0+AhC/jvtMWEzb2m5j2j4OWA= golang.org/x/vuln@v1.1.4 h1:Ju8QsuyhX3Hk8ma3CesTbO8vfJD9EvUBgHvkxHBzj0I= honnef.co/go/tools@v0.7.0-0.dev.0.20250523013057-bbc2f4dd71ea h1:fj8r9irJSpolAGUdZBxJIRY3lLc4jH2Dt4lwnWyWwpw= mvdan.cc/gofumpt@v0.7.0 h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU= mvdan.cc/xurls/v2@v2.6.0 h1:3NTZpeTxYVWNSokW3MKeyVkz/j7uYXYiMtXRUfmjbgI= go: go1.24.3 * Run `code -v` or `code-insiders -v` to get version of VS Code or VS Code Insiders. - 1.100.1 91fa95bccb027ece6a968589bb1d662fa9c8e170 x64 * Check your installed extensions to get the version of the VS Code Go extension - 0.47.3 * Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > `Go: Locate Configured Go Tools` command. - # Tools Configuration ## Environment GOBIN: undefined toolsGopath: gopath: /home/firelizzard/go GOROOT: /usr/lib/go PATH: /usr/local/sbin:/usr/local/bin:/usr/bin:/opt/bin:/usr/lib/llvm/19/bin:/usr/lib/llvm/18/bin:/home/firelizzard/.local/bin:/home/firelizzard/go/bin:/home/firelizzard/go/bin:/home/firelizzard/.bin ## Tools go: /usr/bin/go: go version go1.24.2 linux/amd64 gopls: /home/firelizzard/go/bin/gopls (version: v0.19.0-pre.2 built with go: go1.24.3) gotests: /home/firelizzard/go/bin/gotests (version: v1.6.0 built with go: go1.24.1) impl: /home/firelizzard/go/bin/impl (version: v1.4.0 built with go: go1.24.1) goplay: /home/firelizzard/go/bin/goplay (version: v1.0.0 built with go: go1.24.1) dlv: /home/firelizzard/go/bin/dlv (version: v1.24.1 built with go: go1.24.1) golint: /home/firelizzard/go/bin/golint (version: v0.0.0-20241112194109-818c5a804067 built with go: go1.24.1) ## Go env Workspace Folder (hermes): /home/firelizzard/src/misc/hermes AR='ar' CC='x86_64-pc-linux-gnu-gcc' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_ENABLED='1' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' CXX='x86_64-pc-linux-gnu-g++' GCCGO='/usr/bin/gccgo' GO111MODULE='' GOAMD64='v1' GOARCH='amd64' GOAUTH='netrc' GOBIN='' GOCACHE='/home/firelizzard/.cache/go-build' GOCACHEPROG='' GODEBUG='' GOENV='/home/firelizzard/.config/go/env' GOEXE='' GOEXPERIMENT='' GOFIPS140='off' GOFLAGS='' GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build509238208=/tmp/go-build -gno-record-gcc-switches' GOHOSTARCH='amd64' GOHOSTOS='linux' GOINSECURE='' GOMOD='/home/firelizzard/src/misc/hermes/go.mod' GOMODCACHE='/home/firelizzard/go/pkg/mod' GONOPROXY='github.com/C3Rules/Go-DTRules' GONOSUMDB='github.com/C3Rules/Go-DTRules' GOOS='linux' GOPATH='/home/firelizzard/go' GOPRIVATE='github.com/C3Rules/Go-DTRules' GOPROXY='https://proxy.golang.org,direct' GOROOT='/usr/lib/go' GOSUMDB='sum.golang.org' GOTELEMETRY='on' GOTELEMETRYDIR='/home/firelizzard/.config/go/telemetry' GOTMPDIR='' GOTOOLCHAIN='local' GOTOOLDIR='/usr/lib/go/pkg/tool/linux_amd64' GOVCS='' GOVERSION='go1.24.2' GOWORK='' PKG_CONFIG='pkg-config'
Share the Go related settings you have added/edited
settings
{
"go.useLanguageServer": true,
"go.vetFlags": [
"-composites=false"
],
// "go.formatTool": "goimports",
"go.toolsEnvVars": {
// "CGO_ENABLED": "0",
// "GOOS": "linux"
// "GOOS": "windows"
},
"go.delveConfig": {
"debugAdapter": "dlv-dap",
"hideSystemGoroutines": true,
},
"go.playground": {
"openbrowser": false,
"share": false,
"run": true
},
"go.testFlags": [
"-count=1",
// "-cpu=1",
// "-short",
// "-test.validate.full"
],
"go.testTimeout": "30m",
"go.lintOnSave": "off",
"go.testExplorer.packageDisplayMode": "nested",
"[go]": {
// "editor.formatOnSave": false,
},
"gopls": {
// "ui.documentation.hoverKind": "SynopsisDocumentation",
"ui.codelenses": {
"gc_details": true
},
"ui.diagnostic.analyses": {
"copylocks": false
}
},
"go.languageServerFlags": ["-rpc.trace"],
"go.lintTool": "golint",
"go.inlayHints.parameterNames": true,
"go.inlayHints.functionTypeParameters": true,
"go.inlayHints.constantValues": true,
"go.inlayHints.compositeLiteralFields": true,
"go.toolsManagement.autoUpdate": true,
"go.coverOnTestPackage": false,
}
Describe the bug
Gopls crashes when I interact with &cobra.Command{}
. Specifically the cobra part, I wanted to use it to insert the import.
Steps to reproduce the behavior:
- Click on "cobra".
Screenshots or recordings
The log file is in hermes.zip. I seem to be able to reproduce it just by restarting gopls. It's possible I'm running a version of gopls built from one of my CLs but gopls version
shows golang.org/x/tools/gopls v0.19.0-pre.2
so I think not.
https://github.com/user-attachments/assets/5ecc28b6-b30a-4803-81c3-7eb4f61ff457
Comment From: firelizzard18
The automated reporter didn't work. I think the log file is too big.
Comment From: firelizzard18
I ran sudo rm -rf ~/go/pkg
(some stuff in there was owned by root, probably due to running a job with docker) and rebuilt gopls. It was crashing on one particular file and after this it stopped crashing for that file, so that may have been the issue.