Skip to content

x/tools/gopls: CodeAction: SEGV in internal/modindex.(*Index).Lookup #74131

Closed as duplicate of#74055
@firelizzard18

Description

@firelizzard18

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/[email protected] h1:CUjqNCFGKHPMRZMd/tkBvtkae+eJuGNHOYsGpKxQNj4=
    github.com/BurntSushi/[email protected] h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs=
    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/google/[email protected] h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
    golang.org/x/exp/[email protected] h1:Br3+0EZZohShrmVVc85znGpxw7Ca8hsUJlrdT/JQGw8=
    golang.org/x/[email protected] h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
    golang.org/x/[email protected] h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
    golang.org/x/[email protected] h1:RXY2+rSHXvxO2Y+gKrPjYVaEoGOqh3VEXFhnWAt1Irg=
    golang.org/x/[email protected] h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
    golang.org/x/[email protected] h1:y+3SPx7RmIoU/DCRF+k0+AhC/jvtMWEzb2m5j2j4OWA=
    golang.org/x/[email protected] h1:Ju8QsuyhX3Hk8ma3CesTbO8vfJD9EvUBgHvkxHBzj0I=
    honnef.co/go/[email protected] h1:fj8r9irJSpolAGUdZBxJIRY3lLc4jH2Dt4lwnWyWwpw=
    mvdan.cc/[email protected] h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU=
    mvdan.cc/xurls/[email protected] 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:

  1. 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.

2025-06-06.16-51-05.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions