Skip to content

Commit

Permalink
dep: update wastedassign v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sanposhiho committed Mar 4, 2021
1 parent 507703b commit 2f7db03
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -57,7 +57,7 @@ require (
github.com/polyfloyd/go-errorlint v0.0.0-20201127212506-19bd8db6546f
github.com/ryancurrah/gomodguard v1.2.0
github.com/ryanrolds/sqlclosecheck v0.3.0
github.com/sanposhiho/wastedassign v0.1.3
github.com/sanposhiho/wastedassign v0.2.0
github.com/securego/gosec/v2 v2.6.1
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c
github.com/shirou/gopsutil/v3 v3.21.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions test/testdata/wastedassign.go
Expand Up @@ -28,28 +28,28 @@ func noUseParamsNoError(params string) int {

func manyif(param int) int {
println(param)
useOutOfIf := 1212121 // ERROR "wasted assignment"
useOutOfIf := 1212121 // ERROR "reassigned, but reassigned without using the value"
ret := 0
if false {
useOutOfIf = 200 // ERROR "reassigned, but never used afterwards"
return 0
} else if param == 100 {
useOutOfIf = 100 // ERROR "wasted assignment"
useOutOfIf = 100 // ERROR "reassigned, but reassigned without using the value"
useOutOfIf = 201
useOutOfIf = p(useOutOfIf)
useOutOfIf += 200 // ERROR "wasted assignment"
useOutOfIf += 200 // ERROR "reassigned, but reassigned without using the value"
} else {
useOutOfIf = 100
useOutOfIf += 100
useOutOfIf = p(useOutOfIf)
useOutOfIf += 200 // ERROR "wasted assignment"
useOutOfIf += 200 // ERROR "reassigned, but reassigned without using the value"
}

if false {
useOutOfIf = 200 // ERROR "reassigned, but never used afterwards"
return 0
} else if param == 200 {
useOutOfIf = 100 // ERROR "wasted assignment"
useOutOfIf = 100 // ERROR "reassigned, but reassigned without using the value"
useOutOfIf = 201
useOutOfIf = p(useOutOfIf)
useOutOfIf += 200
Expand Down

0 comments on commit 2f7db03

Please sign in to comment.