diff --git a/go/packages/golist.go b/go/packages/golist.go index 9c895b3895..2ac7c02a3b 100644 --- a/go/packages/golist.go +++ b/go/packages/golist.go @@ -811,8 +811,9 @@ func golistDriver(cfg *Config, rootsDirs func() *goInfo, words ...string) (*driv msg += fmt.Sprintf(": import stack: %v", p.Error.ImportStack) } pkg.Errors = append(pkg.Errors, Error{ - Pos: p.Error.Pos, - Msg: msg, + Pos: p.Error.Pos, + Msg: msg, + Kind: ListError, }) } diff --git a/internal/lsp/source/diagnostics.go b/internal/lsp/source/diagnostics.go index dbc94502b0..9d3c8d41d2 100644 --- a/internal/lsp/source/diagnostics.go +++ b/internal/lsp/source/diagnostics.go @@ -72,7 +72,7 @@ func Diagnostics(ctx context.Context, snapshot Snapshot, f File, withAnalysis bo // Prepare any additional reports for the errors in this package. for _, e := range pkg.GetErrors() { // We only need to handle lower-level errors. - if !(e.Kind == UnknownError || e.Kind == ListError) { + if e.Kind != ListError { continue } // If no file is associated with the error, default to the current file. @@ -138,7 +138,7 @@ func diagnostics(ctx context.Context, snapshot Snapshot, pkg Package, reports ma case TypeError: set.typeErrors = append(set.typeErrors, diag) diag.Source = "compiler" - case ListError, UnknownError: + case ListError: set.listErrors = append(set.listErrors, diag) diag.Source = "go list" }