mirror of
https://github.com/scratchfoundation/golangci-lint.git
synced 2025-08-28 22:28:43 -04:00
Bump wastedassign to v1.0.0 (#1955)
This commit is contained in:
parent
96a7f62b2e
commit
c213e4ed71
3 changed files with 17 additions and 17 deletions
28
test/testdata/wastedassign.go
vendored
28
test/testdata/wastedassign.go
vendored
|
@ -27,28 +27,28 @@ func noUseParams(params string) int {
|
|||
|
||||
func f(param int) int {
|
||||
println(param)
|
||||
useOutOfIf := 1212121 // ERROR "reassigned, but reassigned without using the value"
|
||||
useOutOfIf := 1212121 // ERROR "assigned, but reassigned without using the value"
|
||||
ret := 0
|
||||
if false {
|
||||
useOutOfIf = 200 // ERROR "reassigned, but never used afterwards"
|
||||
useOutOfIf = 200 // ERROR "assigned, but never used afterwards"
|
||||
return 0
|
||||
} else if param == 100 {
|
||||
useOutOfIf = 100 // ERROR "reassigned, but reassigned without using the value"
|
||||
useOutOfIf = 100 // ERROR "assigned, but reassigned without using the value"
|
||||
useOutOfIf = 201
|
||||
useOutOfIf = pa(useOutOfIf)
|
||||
useOutOfIf += 200 // ERROR "reassigned, but reassigned without using the value"
|
||||
useOutOfIf += 200 // ERROR "assigned, but reassigned without using the value"
|
||||
} else {
|
||||
useOutOfIf = 100
|
||||
useOutOfIf += 100
|
||||
useOutOfIf = pa(useOutOfIf)
|
||||
useOutOfIf += 200 // ERROR "reassigned, but reassigned without using the value"
|
||||
useOutOfIf += 200 // ERROR "assigned, but reassigned without using the value"
|
||||
}
|
||||
|
||||
if false {
|
||||
useOutOfIf = 200 // ERROR "reassigned, but never used afterwards"
|
||||
useOutOfIf = 200 // ERROR "assigned, but never used afterwards"
|
||||
return 0
|
||||
} else if param == 200 {
|
||||
useOutOfIf = 100 // ERROR "reassigned, but reassigned without using the value"
|
||||
useOutOfIf = 100 // ERROR "assigned, but reassigned without using the value"
|
||||
useOutOfIf = 201
|
||||
useOutOfIf = pa(useOutOfIf)
|
||||
useOutOfIf += 200
|
||||
|
@ -62,7 +62,7 @@ func f(param int) int {
|
|||
println(useOutOfIf)
|
||||
useOutOfIf = 192
|
||||
useOutOfIf += 100
|
||||
useOutOfIf += 200 // ERROR "reassigned, but never used afterwards"
|
||||
useOutOfIf += 200 // ERROR "assigned, but never used afterwards"
|
||||
return ret
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ func checkLoopTest() int {
|
|||
noUse := 1111
|
||||
println(noUse)
|
||||
|
||||
noUse = 1111 // ERROR "reassigned, but never used afterwards"
|
||||
noUse = 1111 // ERROR "assigned, but never used afterwards"
|
||||
for {
|
||||
if hoge == 14 {
|
||||
break
|
||||
|
@ -86,21 +86,21 @@ func r(param int) int {
|
|||
useOutOfIf := 1212121
|
||||
ret := 0
|
||||
if false {
|
||||
useOutOfIf = 200 // ERROR "reassigned, but never used afterwards"
|
||||
useOutOfIf = 200 // ERROR "assigned, but never used afterwards"
|
||||
return 0
|
||||
} else if param == 100 {
|
||||
ret = useOutOfIf
|
||||
} else if param == 200 {
|
||||
useOutOfIf = 100 // ERROR "reassigned, but reassigned without using the value"
|
||||
useOutOfIf = 100 // ERROR "assigned, but reassigned without using the value"
|
||||
useOutOfIf = 100
|
||||
useOutOfIf = pa(useOutOfIf)
|
||||
useOutOfIf += 200 // ERROR "reassigned, but reassigned without using the value"
|
||||
useOutOfIf += 200 // ERROR "assigned, but reassigned without using the value"
|
||||
}
|
||||
useOutOfIf = 12
|
||||
println(useOutOfIf)
|
||||
useOutOfIf = 192
|
||||
useOutOfIf += 100
|
||||
useOutOfIf += 200 // ERROR "reassigned, but never used afterwards"
|
||||
useOutOfIf += 200 // ERROR "assigned, but never used afterwards"
|
||||
return ret
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ func mugen() {
|
|||
var i int
|
||||
var hoge int
|
||||
for {
|
||||
hoge = 5 // ERROR "reassigned, but reassigned without using the value"
|
||||
hoge = 5 // ERROR "assigned, but reassigned without using the value"
|
||||
// break
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue