Skip to content

Commit 2dcc761

Browse files
authored
Update wastedassign to v2.0.6 (#2020)
* Update: wastedassign to v2.0.5 * Update: wastedassign to v2.0.6
1 parent 7776b54 commit 2dcc761

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ require (
6060
github.com/polyfloyd/go-errorlint v0.0.0-20210510181950-ab96adb96fea
6161
github.com/ryancurrah/gomodguard v1.2.1
6262
github.com/ryanrolds/sqlclosecheck v0.3.0
63-
github.com/sanposhiho/wastedassign v1.0.0
63+
github.com/sanposhiho/wastedassign/v2 v2.0.6
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

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/golinters/wastedassign.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package golinters
22

33
import (
4-
"github.com/sanposhiho/wastedassign"
4+
"github.com/sanposhiho/wastedassign/v2"
55
"golang.org/x/tools/go/analysis"
66

77
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"

test/testdata/wastedassign.go

+14-14
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 "assigned, but reassigned without using the value"
30+
useOutOfIf := 1212121 // ERROR "assigned to useOutOfIf, but reassigned without using the value"
3131
ret := 0
3232
if false {
33-
useOutOfIf = 200 // ERROR "assigned, but never used afterwards"
33+
useOutOfIf = 200 // ERROR "assigned to useOutOfIf, but never used afterwards"
3434
return 0
3535
} else if param == 100 {
36-
useOutOfIf = 100 // ERROR "assigned, but reassigned without using the value"
36+
useOutOfIf = 100 // ERROR "assigned to useOutOfIf, but reassigned without using the value"
3737
useOutOfIf = 201
3838
useOutOfIf = pa(useOutOfIf)
39-
useOutOfIf += 200 // ERROR "assigned, but reassigned without using the value"
39+
useOutOfIf += 200 // ERROR "assigned to useOutOfIf, but reassigned without using the value"
4040
} else {
4141
useOutOfIf = 100
4242
useOutOfIf += 100
4343
useOutOfIf = pa(useOutOfIf)
44-
useOutOfIf += 200 // ERROR "assigned, but reassigned without using the value"
44+
useOutOfIf += 200 // ERROR "assigned to useOutOfIf, but reassigned without using the value"
4545
}
4646

4747
if false {
48-
useOutOfIf = 200 // ERROR "assigned, but never used afterwards"
48+
useOutOfIf = 200 // ERROR "assigned to useOutOfIf, but never used afterwards"
4949
return 0
5050
} else if param == 200 {
51-
useOutOfIf = 100 // ERROR "assigned, but reassigned without using the value"
51+
useOutOfIf = 100 // ERROR "assigned to useOutOfIf, 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 "assigned, but never used afterwards"
65+
useOutOfIf += 200 // ERROR "assigned to useOutOfIf, 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 "assigned, but never used afterwards"
74+
noUse = 1111 // ERROR "assigned to noUse, 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 "assigned, but never used afterwards"
89+
useOutOfIf = 200 // ERROR "assigned to useOutOfIf, but never used afterwards"
9090
return 0
9191
} else if param == 100 {
9292
ret = useOutOfIf
9393
} else if param == 200 {
94-
useOutOfIf = 100 // ERROR "assigned, but reassigned without using the value"
94+
useOutOfIf = 100 // ERROR "assigned to useOutOfIf, but reassigned without using the value"
9595
useOutOfIf = 100
9696
useOutOfIf = pa(useOutOfIf)
97-
useOutOfIf += 200 // ERROR "assigned, but reassigned without using the value"
97+
useOutOfIf += 200 // ERROR "assigned to useOutOfIf, but reassigned without using the value"
9898
}
9999
useOutOfIf = 12
100100
println(useOutOfIf)
101101
useOutOfIf = 192
102102
useOutOfIf += 100
103-
useOutOfIf += 200 // ERROR "assigned, but never used afterwards"
103+
useOutOfIf += 200 // ERROR "assigned to useOutOfIf, 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 "assigned, but reassigned without using the value"
111+
hoge = 5 // ERROR "assigned to hoge, but reassigned without using the value"
112112
// break
113113
}
114114

0 commit comments

Comments
 (0)