mirror of
https://github.com/golang/go
synced 2024-11-18 18:04:46 -07:00
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: 57d832932859360d4668711ab6b46ac8cdd2e010 GitHub-Pull-Request: golang/tools#164 Reviewed-on: https://go-review.googlesource.com/c/tools/+/197338 Reviewed-by: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
parent
2e68ad74ea
commit
e4ea94538f
@ -103,7 +103,7 @@ func (s *Set) AllObjectFacts(filter map[reflect.Type]bool) []analysis.ObjectFact
|
||||
var facts []analysis.ObjectFact
|
||||
for k, v := range s.m {
|
||||
if k.obj != nil && filter[k.t] {
|
||||
facts = append(facts, analysis.ObjectFact{k.obj, v})
|
||||
facts = append(facts, analysis.ObjectFact{Object: k.obj, Fact: v})
|
||||
}
|
||||
}
|
||||
return facts
|
||||
@ -136,7 +136,7 @@ func (s *Set) AllPackageFacts(filter map[reflect.Type]bool) []analysis.PackageFa
|
||||
var facts []analysis.PackageFact
|
||||
for k, v := range s.m {
|
||||
if k.obj == nil && filter[k.t] {
|
||||
facts = append(facts, analysis.PackageFact{k.pkg, v})
|
||||
facts = append(facts, analysis.PackageFact{Package: k.pkg, Fact: v})
|
||||
}
|
||||
}
|
||||
return facts
|
||||
|
@ -63,7 +63,9 @@ func run(pass *analysis.Pass) (interface{}, error) {
|
||||
pass.Report(analysis.Diagnostic{
|
||||
Pos: stmt.Pos(), Message: fmt.Sprintf("self-assignment of %s to %s", re, le),
|
||||
SuggestedFixes: []analysis.SuggestedFix{
|
||||
{Message: "Remove", TextEdits: []analysis.TextEdit{{stmt.Pos(), stmt.End(), []byte{}}}},
|
||||
{Message: "Remove", TextEdits: []analysis.TextEdit{
|
||||
{Pos: stmt.Pos(), End: stmt.End(), NewText: []byte{}},
|
||||
}},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user