golang/go

x/tools/gopls: CodeAction: nil panic in findMatchingDiagnostics

adonovan opened this issue · 2 comments

#!stacks
"sigpanic" && "findMatchingDiagnostics:+5"

Issue created by stacks.

func (s *server) findMatchingDiagnostics(uri protocol.DocumentURI, pd protocol.Diagnostic) []*cache.Diagnostic {
	s.diagnosticsMu.Lock()
	defer s.diagnosticsMu.Unlock()

	var sds []*cache.Diagnostic
	for _, viewDiags := range s.diagnostics[uri].byView {   // nil deref panic

This stack mX6OTg was reported by telemetry:

golang.org/x/tools/gopls@v0.17.0 go1.23.1 darwin/arm64 other (1)

Change https://go.dev/cl/639396 mentions this issue: gopls/internal/server: fix nil panic in findMatchingDiagnostics