Skip to content

x/tools/gopls: Parse: crash in fixInitStmt #72026

Closed
@adonovan

Description

@adonovan
#!stacks
"goPanicSliceAcap" && "fixInitStmt:+10"

Issue created by stacks.

This is not how to use safetoken:

	// Try to extract a statement from the BadExpr.
	start, end, err := safetoken.Offsets(tok, bad.Pos(), bad.End()-1)
	if err != nil {
		return false
	}
	stmtBytes := src[start : end+1]
	stmt, err := parseStmt(tok, bad.Pos(), stmtBytes)
	if err != nil {
		return false
	}

This stack LKUsng was reported by telemetry:

golang.org/x/tools/[email protected] go1.24.0 linux/amd64 vscode (2)

Dups: Dyo-dQ Cys7zA hq9Myg 7jyMQQ sM9gIg _GxDgw EiTsgQ MISCIg 55dYaQ

Metadata

Metadata

Assignees

Labels

BugReportIssues 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.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.gopls/telemetry-wins

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions