Skip to content

Commit e4ea945

Browse files
hasitpbhattBryan C. Mills
authored and
Bryan C. Mills
committed
go/analysis: fix vet errors
Updating tools version in go fails the builds due to go vet errors as it can be observed in https://golang.org/cl/196843. Fix vet errors in facts.go and assign.go Updates golang/go#34062 Change-Id: I8e5a819a08d0bdc91c4fb21761065f026581bcd2 GitHub-Last-Rev: 57d8329 GitHub-Pull-Request: #164 Reviewed-on: https://go-review.googlesource.com/c/tools/+/197338 Reviewed-by: Bryan C. Mills <[email protected]> Run-TryBot: Bryan C. Mills <[email protected]>
1 parent 2e68ad7 commit e4ea945

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

go/analysis/internal/facts/facts.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func (s *Set) AllObjectFacts(filter map[reflect.Type]bool) []analysis.ObjectFact
103103
var facts []analysis.ObjectFact
104104
for k, v := range s.m {
105105
if k.obj != nil && filter[k.t] {
106-
facts = append(facts, analysis.ObjectFact{k.obj, v})
106+
facts = append(facts, analysis.ObjectFact{Object: k.obj, Fact: v})
107107
}
108108
}
109109
return facts
@@ -136,7 +136,7 @@ func (s *Set) AllPackageFacts(filter map[reflect.Type]bool) []analysis.PackageFa
136136
var facts []analysis.PackageFact
137137
for k, v := range s.m {
138138
if k.obj == nil && filter[k.t] {
139-
facts = append(facts, analysis.PackageFact{k.pkg, v})
139+
facts = append(facts, analysis.PackageFact{Package: k.pkg, Fact: v})
140140
}
141141
}
142142
return facts

go/analysis/passes/assign/assign.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ func run(pass *analysis.Pass) (interface{}, error) {
6363
pass.Report(analysis.Diagnostic{
6464
Pos: stmt.Pos(), Message: fmt.Sprintf("self-assignment of %s to %s", re, le),
6565
SuggestedFixes: []analysis.SuggestedFix{
66-
{Message: "Remove", TextEdits: []analysis.TextEdit{{stmt.Pos(), stmt.End(), []byte{}}}},
66+
{Message: "Remove", TextEdits: []analysis.TextEdit{
67+
{Pos: stmt.Pos(), End: stmt.End(), NewText: []byte{}},
68+
}},
6769
},
6870
})
6971
}

0 commit comments

Comments
 (0)