1
0
mirror of https://github.com/mgechev/revive.git synced 2024-11-24 08:32:22 +02:00
This commit is contained in:
SalvadorC 2020-02-26 21:32:47 +01:00 committed by GitHub
parent 90098926eb
commit 8f61c9ad71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 12 deletions

View File

@ -1,26 +1,25 @@
package fixtures
import (
"go/ast"
)
func one(a int) {
a,b:= 1,2 // MATCH /parameter 'a' seems to be modified/
a++ // MATCH /parameter 'a' seems to be modified/
a, b := 1, 2 // MATCH /parameter 'a' seems to be modified/
a++ // MATCH /parameter 'a' seems to be modified/
}
func two(b, c float32) {
if c>0.0 {
b = 1 // MATCH /parameter 'b' seems to be modified/
}
if c > 0.0 {
b = 1 // MATCH /parameter 'b' seems to be modified/
}
}
type foo struct {
a string
a string
}
func three(s *foo) {
s.a = "foooooo"
s.a = "foooooo"
}
// non regression test for issue 355
func issue355(_ *foo) {
_ = "foooooo"
}

View File

@ -37,6 +37,10 @@ func retrieveParamNames(pl []*ast.Field) map[string]bool {
result := make(map[string]bool, len(pl))
for _, p := range pl {
for _, n := range p.Names {
if n.Name == "_" {
continue
}
result[n.Name] = true
}
}