Skip to content

Commit ad85a67

Browse files
committed
gopls/internal/lsp/source: eliminate AnalyzerErrorKind
It is less clear than simply inlining the type conversion. Change-Id: Icdf32ac46797345fd6134dde725848839ad5d8de Reviewed-on: https://go-review.googlesource.com/c/tools/+/545203 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com>
1 parent 2c02506 commit ad85a67

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

gopls/internal/lsp/cache/errors.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ func decodeDiagnostics(data []byte) []*Diagnostic {
259259
Severity: gobDiag.Severity,
260260
Code: gobDiag.Code,
261261
CodeHref: gobDiag.CodeHref,
262-
Source: AnalyzerErrorKind(gobDiag.Source),
262+
Source: DiagnosticSource(gobDiag.Source),
263263
Message: gobDiag.Message,
264264
Tags: gobDiag.Tags,
265265
Related: srcRelated,
@@ -293,7 +293,7 @@ func toSourceDiagnostic(srcAnalyzer *settings.Analyzer, gobDiag *gobDiagnostic)
293293
Severity: severity,
294294
Code: gobDiag.Code,
295295
CodeHref: gobDiag.CodeHref,
296-
Source: AnalyzerErrorKind(gobDiag.Source),
296+
Source: DiagnosticSource(gobDiag.Source),
297297
Message: gobDiag.Message,
298298
Related: related,
299299
Tags: srcAnalyzer.Tag,

gopls/internal/lsp/cache/pkg.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ type (
3232
Metadata = metadata.Metadata
3333

3434
// Diagnostics.
35-
Diagnostic = source.Diagnostic
36-
SuggestedFix = source.SuggestedFix
35+
Diagnostic = source.Diagnostic
36+
SuggestedFix = source.SuggestedFix
37+
DiagnosticSource = source.DiagnosticSource
3738

3839
// Computed objects.
3940
TidiedModule = source.TidiedModule
40-
ParsedGoFile = source.ParsedGoFile
41+
ParsedGoFile = parsego.File
4142
ParsedModule = source.ParsedModule
4243
ParsedWorkFile = source.ParsedWorkFile
4344
Package_ = source.Package // renamed to avoid conflict
@@ -76,7 +77,6 @@ var (
7677
NewFilterer = source.NewFilterer
7778
BuildLink = source.BuildLink
7879
CanFix = source.CanFix
79-
AnalyzerErrorKind = source.AnalyzerErrorKind
8080
)
8181

8282
// A Package is the union of package metadata and type checking results.

gopls/internal/lsp/source/snapshot.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,3 @@ const (
450450
WorkFileError DiagnosticSource = "go.work file"
451451
ConsistencyInfo DiagnosticSource = "consistency"
452452
)
453-
454-
func AnalyzerErrorKind(name string) DiagnosticSource {
455-
return DiagnosticSource(name)
456-
}

0 commit comments

Comments
 (0)