Skip to content

Commit c213e4e

Browse files
authored
Bump wastedassign to v1.0.0 (#1955)
1 parent 96a7f62 commit c213e4e

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ require (
6060
github.com/polyfloyd/go-errorlint v0.0.0-20210418123303-74da32850375
6161
github.com/ryancurrah/gomodguard v1.2.0
6262
github.com/ryanrolds/sqlclosecheck v0.3.0
63-
github.com/sanposhiho/wastedassign v0.2.0
63+
github.com/sanposhiho/wastedassign v1.0.0
6464
github.com/securego/gosec/v2 v2.7.0
6565
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c
6666
github.com/shirou/gopsutil/v3 v3.21.4

go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/testdata/wastedassign.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,28 @@ func noUseParams(params string) int {
2727

2828
func f(param int) int {
2929
println(param)
30-
useOutOfIf := 1212121 // ERROR "reassigned, but reassigned without using the value"
30+
useOutOfIf := 1212121 // ERROR "assigned, but reassigned without using the value"
3131
ret := 0
3232
if false {
33-
useOutOfIf = 200 // ERROR "reassigned, but never used afterwards"
33+
useOutOfIf = 200 // ERROR "assigned, but never used afterwards"
3434
return 0
3535
} else if param == 100 {
36-
useOutOfIf = 100 // ERROR "reassigned, but reassigned without using the value"
36+
useOutOfIf = 100 // ERROR "assigned, but reassigned without using the value"
3737
useOutOfIf = 201
3838
useOutOfIf = pa(useOutOfIf)
39-
useOutOfIf += 200 // ERROR "reassigned, but reassigned without using the value"
39+
useOutOfIf += 200 // ERROR "assigned, but reassigned without using the value"
4040
} else {
4141
useOutOfIf = 100
4242
useOutOfIf += 100
4343
useOutOfIf = pa(useOutOfIf)
44-
useOutOfIf += 200 // ERROR "reassigned, but reassigned without using the value"
44+
useOutOfIf += 200 // ERROR "assigned, but reassigned without using the value"
4545
}
4646

4747
if false {
48-
useOutOfIf = 200 // ERROR "reassigned, but never used afterwards"
48+
useOutOfIf = 200 // ERROR "assigned, but never used afterwards"
4949
return 0
5050
} else if param == 200 {
51-
useOutOfIf = 100 // ERROR "reassigned, but reassigned without using the value"
51+
useOutOfIf = 100 // ERROR "assigned, but reassigned without using the value"
5252
useOutOfIf = 201
5353
useOutOfIf = pa(useOutOfIf)
5454
useOutOfIf += 200
@@ -62,7 +62,7 @@ func f(param int) int {
6262
println(useOutOfIf)
6363
useOutOfIf = 192
6464
useOutOfIf += 100
65-
useOutOfIf += 200 // ERROR "reassigned, but never used afterwards"
65+
useOutOfIf += 200 // ERROR "assigned, but never used afterwards"
6666
return ret
6767
}
6868

@@ -71,7 +71,7 @@ func checkLoopTest() int {
7171
noUse := 1111
7272
println(noUse)
7373

74-
noUse = 1111 // ERROR "reassigned, but never used afterwards"
74+
noUse = 1111 // ERROR "assigned, but never used afterwards"
7575
for {
7676
if hoge == 14 {
7777
break
@@ -86,29 +86,29 @@ func r(param int) int {
8686
useOutOfIf := 1212121
8787
ret := 0
8888
if false {
89-
useOutOfIf = 200 // ERROR "reassigned, but never used afterwards"
89+
useOutOfIf = 200 // ERROR "assigned, but never used afterwards"
9090
return 0
9191
} else if param == 100 {
9292
ret = useOutOfIf
9393
} else if param == 200 {
94-
useOutOfIf = 100 // ERROR "reassigned, but reassigned without using the value"
94+
useOutOfIf = 100 // ERROR "assigned, but reassigned without using the value"
9595
useOutOfIf = 100
9696
useOutOfIf = pa(useOutOfIf)
97-
useOutOfIf += 200 // ERROR "reassigned, but reassigned without using the value"
97+
useOutOfIf += 200 // ERROR "assigned, but reassigned without using the value"
9898
}
9999
useOutOfIf = 12
100100
println(useOutOfIf)
101101
useOutOfIf = 192
102102
useOutOfIf += 100
103-
useOutOfIf += 200 // ERROR "reassigned, but never used afterwards"
103+
useOutOfIf += 200 // ERROR "assigned, but never used afterwards"
104104
return ret
105105
}
106106

107107
func mugen() {
108108
var i int
109109
var hoge int
110110
for {
111-
hoge = 5 // ERROR "reassigned, but reassigned without using the value"
111+
hoge = 5 // ERROR "assigned, but reassigned without using the value"
112112
// break
113113
}
114114

0 commit comments

Comments
 (0)