Bump wastedassign to v1.0.0 (#1955)
This commit is contained in:
parent
96a7f62b2e
commit
c213e4ed71
2
go.mod
2
go.mod
@ -60,7 +60,7 @@ require (
|
||||
github.com/polyfloyd/go-errorlint v0.0.0-20210418123303-74da32850375
|
||||
github.com/ryancurrah/gomodguard v1.2.0
|
||||
github.com/ryanrolds/sqlclosecheck v0.3.0
|
||||
github.com/sanposhiho/wastedassign v0.2.0
|
||||
github.com/sanposhiho/wastedassign v1.0.0
|
||||
github.com/securego/gosec/v2 v2.7.0
|
||||
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c
|
||||
github.com/shirou/gopsutil/v3 v3.21.4
|
||||
|
4
go.sum
generated
4
go.sum
generated
@ -543,8 +543,8 @@ github.com/ryancurrah/gomodguard v1.2.0/go.mod h1:rNqbC4TOIdUDcVMSIpNNAzTbzXAZa6
|
||||
github.com/ryanrolds/sqlclosecheck v0.3.0 h1:AZx+Bixh8zdUBxUA1NxbxVAS78vTPq4rCb8OUZI9xFw=
|
||||
github.com/ryanrolds/sqlclosecheck v0.3.0/go.mod h1:1gREqxyTGR3lVtpngyFo3hZAgk0KCtEdgEkHwDbigdA=
|
||||
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
github.com/sanposhiho/wastedassign v0.2.0 h1:0vycy8D/Ky55U5ub8oJFqyDv9M4ICM/wte9sAp2/7Mc=
|
||||
github.com/sanposhiho/wastedassign v0.2.0/go.mod h1:LGpq5Hsv74QaqM47WtIsRSF/ik9kqk07kchgv66tLVE=
|
||||
github.com/sanposhiho/wastedassign v1.0.0 h1:dB+7OV0iJ5b0SpGwKjKlPCr8GDZJX6Ylm3YG+66xGpc=
|
||||
github.com/sanposhiho/wastedassign v1.0.0/go.mod h1:LGpq5Hsv74QaqM47WtIsRSF/ik9kqk07kchgv66tLVE=
|
||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
||||
github.com/securego/gosec/v2 v2.7.0 h1:mOhJv5w6UyNLpSssQOQCc7eGkKLuicAxvf66Ey/X4xk=
|
||||
github.com/securego/gosec/v2 v2.7.0/go.mod h1:xNbGArrGUspJLuz3LS5XCY1EBW/0vABAl/LWfSklmiM=
|
||||
|
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…
x
Reference in New Issue
Block a user