mirror of
https://github.com/mgechev/revive.git
synced 2025-07-17 01:12:27 +02:00
@ -1,26 +1,25 @@
|
|||||||
package fixtures
|
package fixtures
|
||||||
|
|
||||||
import (
|
|
||||||
"go/ast"
|
|
||||||
)
|
|
||||||
|
|
||||||
func one(a int) {
|
func one(a int) {
|
||||||
a,b:= 1,2 // 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/
|
a++ // MATCH /parameter 'a' seems to be modified/
|
||||||
}
|
}
|
||||||
|
|
||||||
func two(b, c float32) {
|
func two(b, c float32) {
|
||||||
if c>0.0 {
|
if c > 0.0 {
|
||||||
b = 1 // MATCH /parameter 'b' seems to be modified/
|
b = 1 // MATCH /parameter 'b' seems to be modified/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type foo struct {
|
type foo struct {
|
||||||
a string
|
a string
|
||||||
}
|
}
|
||||||
|
|
||||||
func three(s *foo) {
|
func three(s *foo) {
|
||||||
s.a = "foooooo"
|
s.a = "foooooo"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// non regression test for issue 355
|
||||||
|
func issue355(_ *foo) {
|
||||||
|
_ = "foooooo"
|
||||||
|
}
|
||||||
|
@ -37,6 +37,10 @@ func retrieveParamNames(pl []*ast.Field) map[string]bool {
|
|||||||
result := make(map[string]bool, len(pl))
|
result := make(map[string]bool, len(pl))
|
||||||
for _, p := range pl {
|
for _, p := range pl {
|
||||||
for _, n := range p.Names {
|
for _, n := range p.Names {
|
||||||
|
if n.Name == "_" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
result[n.Name] = true
|
result[n.Name] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user