-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.gopls/telemetry-wins
Milestone
Description
#!stacks
"sigpanic" && "types.(*Selection).Index" && "golang.hover:+188"
Issue created by stacks.
// When hovering over a reference to a promoted struct field,
// show the implicitly selected intervening fields.
cur, ok := pgf.Cursor.FindByPos(pos, pos)
if !ok {
return protocol.Range{}, nil, fmt.Errorf("Invalid hover position, failed to get cursor")
}
if obj, ok := obj.(*types.Var); ok && obj.IsField() {
if selExpr, ok := cur.Parent().Node().(*ast.SelectorExpr); ok {
sel := pkg.TypesInfo().Selections[selExpr]
if len(sel.Index()) > 1 { <----- panics is sel is zero
This stack j9Y3kA
was reported by telemetry:
crash/crash
runtime.gopanic:+69,+0x167
runtime.panicmem:=262,+0x197
runtime.sigpanic:+9,+0x167
go/types.(*Selection).Index:=137,+0xf4e
golang.org/x/tools/gopls/internal/golang.hover:+188,+0xf53
golang.org/x/tools/gopls/internal/golang.Hover:+4,+0xbe
golang.org/x/tools/gopls/internal/server.(*server).Hover:+30,+0x3aa
golang.org/x/tools/gopls/internal/protocol.serverDispatch:+335,+0xe99
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func4:+5,+0x84
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func5:+52,+0x908
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2,+0xc5
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2:+3,+0x95
runtime.goexit:+0,+0x0
golang.org/x/tools/[email protected] go1.24.3 windows/amd64 vscode (1)
Dups: nagHbw cJUhUw
Metadata
Metadata
Assignees
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.gopls/telemetry-wins