Skip to content

Commit 5adc314

Browse files
build: update to golangci-lint 1.61.0 (#30587)
Changelog: https://golangci-lint.run/product/changelog/#1610 Removes `exportloopref` (no longer needed), replaces it with `copyloopvar` which is basically the opposite. Also adds: - `durationcheck` - `gocheckcompilerdirectives` - `reassign` - `mirror` - `tenv` --------- Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
1 parent f4dc753 commit 5adc314

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+52
-100
lines changed

.golangci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ linters:
2121
- staticcheck
2222
- bidichk
2323
- durationcheck
24-
- exportloopref
24+
- copyloopvar
2525
- whitespace
2626
- revive # only certain checks enabled
27-
27+
- durationcheck
28+
- gocheckcompilerdirectives
29+
- reassign
30+
- mirror
31+
- tenv
2832
### linters we tried and will not be using:
2933
###
3034
# - structcheck # lots of false positives

accounts/abi/abi_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,6 @@ func TestUnpackRevert(t *testing.T) {
11991199
{"4e487b7100000000000000000000000000000000000000000000000000000000000000ff", "unknown panic code: 0xff", nil},
12001200
}
12011201
for index, c := range cases {
1202-
index, c := index, c
12031202
t.Run(fmt.Sprintf("case %d", index), func(t *testing.T) {
12041203
t.Parallel()
12051204
got, err := UnpackRevert(common.Hex2Bytes(c.input))

accounts/abi/bind/bind.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]
252252
}
253253
// Parse library references.
254254
for pattern, name := range libs {
255-
matched, err := regexp.Match("__\\$"+pattern+"\\$__", []byte(contracts[types[i]].InputBin))
255+
matched, err := regexp.MatchString("__\\$"+pattern+"\\$__", contracts[types[i]].InputBin)
256256
if err != nil {
257257
log.Error("Could not search for pattern", "pattern", pattern, "contract", contracts[types[i]], "err", err)
258258
}

accounts/abi/event_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ func TestEventTupleUnpack(t *testing.T) {
331331

332332
for _, tc := range testCases {
333333
assert := assert.New(t)
334-
tc := tc
335334
t.Run(tc.name, func(t *testing.T) {
336335
err := unpackTestEventData(tc.dest, tc.data, tc.jsonLog, assert)
337336
if tc.error == "" {

accounts/abi/pack_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import (
3434
func TestPack(t *testing.T) {
3535
t.Parallel()
3636
for i, test := range packUnpackTests {
37-
i, test := i, test
3837
t.Run(strconv.Itoa(i), func(t *testing.T) {
3938
t.Parallel()
4039
encb, err := hex.DecodeString(test.packed)

accounts/abi/reflect_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ var reflectTests = []reflectTest{
172172
func TestReflectNameToStruct(t *testing.T) {
173173
t.Parallel()
174174
for _, test := range reflectTests {
175-
test := test
176175
t.Run(test.name, func(t *testing.T) {
177176
t.Parallel()
178177
m, err := mapArgNamesToStructFields(test.args, reflect.ValueOf(test.struc))

accounts/abi/topics_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ func TestMakeTopics(t *testing.T) {
137137
},
138138
}
139139
for _, tt := range tests {
140-
tt := tt
141140
t.Run(tt.name, func(t *testing.T) {
142141
t.Parallel()
143142
got, err := MakeTopics(tt.args.query...)
@@ -373,7 +372,6 @@ func TestParseTopics(t *testing.T) {
373372
tests := setupTopicsTests()
374373

375374
for _, tt := range tests {
376-
tt := tt
377375
t.Run(tt.name, func(t *testing.T) {
378376
t.Parallel()
379377
createObj := tt.args.createObj()
@@ -393,7 +391,6 @@ func TestParseTopicsIntoMap(t *testing.T) {
393391
tests := setupTopicsTests()
394392

395393
for _, tt := range tests {
396-
tt := tt
397394
t.Run(tt.name, func(t *testing.T) {
398395
t.Parallel()
399396
outMap := make(map[string]interface{})

accounts/abi/unpack_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@ func TestMethodMultiReturn(t *testing.T) {
389389
"Can not unpack into a slice with wrong types",
390390
}}
391391
for _, tc := range testCases {
392-
tc := tc
393392
t.Run(tc.name, func(t *testing.T) {
394393
require := require.New(t)
395394
err := abi.UnpackIntoInterface(tc.dest, "multi", data)
@@ -947,7 +946,7 @@ func TestOOMMaliciousInput(t *testing.T) {
947946
}
948947
encb, err := hex.DecodeString(test.enc)
949948
if err != nil {
950-
t.Fatalf("invalid hex: %s" + test.enc)
949+
t.Fatalf("invalid hex: %s", test.enc)
951950
}
952951
_, err = abi.Methods["method"].Outputs.UnpackValues(encb)
953952
if err == nil {

build/checksums.txt

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -56,37 +56,37 @@ f45af3e1434175ff85620a74c07fb41d6844655f1f2cd2389c5fca6de000f58c go1.23.2.freeb
5656
f626cdd92fc21a88b31c1251f419c17782933a42903db87a174ce74eeecc66a9 go1.23.2.linux-arm64.tar.gz
5757
fa70d39ddeb6b55241a30b48d7af4e681c6a7d7104e8326c3bc1b12a75e091cc go1.23.2.solaris-amd64.tar.gz
5858

59-
# version:golangci 1.59.0
59+
# version:golangci 1.61.0
6060
# https://github.com/golangci/golangci-lint/releases/
61-
# https://github.com/golangci/golangci-lint/releases/download/v1.59.0/
62-
418acf7e255ddc0783e97129c9b03d9311b77826a5311d425a01c708a86417e7 golangci-lint-1.59.0-darwin-amd64.tar.gz
63-
5f6a1d95a6dd69f6e328eb56dd311a38e04cfab79a1305fbf4957f4e203f47b6 golangci-lint-1.59.0-darwin-arm64.tar.gz
64-
8899bf589185d49f747f3e5db9f0bde8a47245a100c64a3dd4d65e8e92cfc4f2 golangci-lint-1.59.0-freebsd-386.tar.gz
65-
658212f138d9df2ac89427e22115af34bf387c0871d70f2a25101718946a014f golangci-lint-1.59.0-freebsd-amd64.tar.gz
66-
4c6395ea40f314d3b6fa17d8997baab93464d5d1deeaab513155e625473bd03a golangci-lint-1.59.0-freebsd-armv6.tar.gz
67-
ff37da4fbaacdb6bbae70fdbdbb1ba932a859956f788c82822fa06bef5b7c6b3 golangci-lint-1.59.0-freebsd-armv7.tar.gz
68-
439739469ed2bda182b1ec276d40c40e02f195537f78e3672996741ad223d6b6 golangci-lint-1.59.0-illumos-amd64.tar.gz
69-
940801d46790e40d0a097d8fee34e2606f0ef148cd039654029b0b8750a15ed6 golangci-lint-1.59.0-linux-386.tar.gz
70-
3b14a439f33c4fff83dbe0349950d984042b9a1feb6c62f82787b598fc3ab5f4 golangci-lint-1.59.0-linux-amd64.tar.gz
71-
c57e6c0b0fa03089a2611dceddd5bc5d206716cccdff8b149da8baac598719a1 golangci-lint-1.59.0-linux-arm64.tar.gz
72-
93149e2d3b25ac754df9a23172403d8aa6d021a7e0d9c090a12f51897f68c9a0 golangci-lint-1.59.0-linux-armv6.tar.gz
73-
d10ac38239d9efee3ee87b55c96cdf3fa09e1a525babe3ffdaaf65ccc48cf3dc golangci-lint-1.59.0-linux-armv7.tar.gz
74-
047338114b4f0d5f08f0fb9a397b03cc171916ed0960be7dfb355c2320cd5e9c golangci-lint-1.59.0-linux-loong64.tar.gz
75-
5632df0f7f8fc03a80a266130faef0b5902d280cf60621f1b2bdc1aef6d97ee9 golangci-lint-1.59.0-linux-mips64.tar.gz
76-
71dd638c82fa4439171e7126d2c7a32b5d103bfdef282cea40c83632cb3d1f4b golangci-lint-1.59.0-linux-mips64le.tar.gz
77-
6cf9ea0d34e91669948483f9ae7f07da319a879344373a1981099fbd890cde00 golangci-lint-1.59.0-linux-ppc64le.tar.gz
78-
af0205fa6fbab197cee613c359947711231739095d21b5c837086233b36ad971 golangci-lint-1.59.0-linux-riscv64.tar.gz
79-
a9d2fb93f3c688ebccef94f5dc96c0b07c4d20bf6556cddebd8442159b0c80f6 golangci-lint-1.59.0-linux-s390x.tar.gz
80-
68ab4c57a847b8ace9679887f2f8b2b6760e57ee29dcde8c3f40dd8bb2654fa2 golangci-lint-1.59.0-netbsd-386.tar.gz
81-
d277b8b435c19406d00de4d509eadf5a024a5782878332e9a1b7c02bb76e87a7 golangci-lint-1.59.0-netbsd-amd64.tar.gz
82-
83211656be8dcfa1545af4f92894409f412d1f37566798cb9460a526593ad62c golangci-lint-1.59.0-netbsd-arm64.tar.gz
83-
6c6866d28bf79fa9817a0f7d2b050890ed109cae80bdb4dfa39536a7226da237 golangci-lint-1.59.0-netbsd-armv6.tar.gz
84-
11587566363bd03ca586b7df9776ccaed569fcd1f3489930ac02f9375b307503 golangci-lint-1.59.0-netbsd-armv7.tar.gz
85-
466181a8967bafa495e41494f93a0bec829c2cf715de874583b0460b3b8ae2b8 golangci-lint-1.59.0-windows-386.zip
86-
3317d8a87a99a49a0a1321d295c010790e6dbf43ee96b318f4b8bb23eae7a565 golangci-lint-1.59.0-windows-amd64.zip
87-
b3af955c7fceac8220a36fc799e1b3f19d3b247d32f422caac5f9845df8f7316 golangci-lint-1.59.0-windows-arm64.zip
88-
6f083c7d0c764e5a0e5bde46ee3e91ae357d80c194190fe1d9754392e9064c7e golangci-lint-1.59.0-windows-armv6.zip
89-
3709b4dd425deadab27748778d08e03c0f804d7748f7dd5b6bb488d98aa031c7 golangci-lint-1.59.0-windows-armv7.zip
61+
# https://github.com/golangci/golangci-lint/releases/download/v1.61.0/
62+
5c280ef3284f80c54fd90d73dc39ca276953949da1db03eb9dd0fbf868cc6e55 golangci-lint-1.61.0-darwin-amd64.tar.gz
63+
544334890701e4e04a6e574bc010bea8945205c08c44cced73745a6378012d36 golangci-lint-1.61.0-darwin-arm64.tar.gz
64+
e885a6f561092055930ebd298914d80e8fd2e10d2b1e9942836c2c6a115301fa golangci-lint-1.61.0-freebsd-386.tar.gz
65+
b13f6a3f11f65e7ff66b734d7554df3bbae0f485768848424e7554ed289e19c2 golangci-lint-1.61.0-freebsd-amd64.tar.gz
66+
cd8e7bbe5b8f33ed1597aa1cc588da96a3b9f22e1b9ae60d93511eae1a0ee8c5 golangci-lint-1.61.0-freebsd-armv6.tar.gz
67+
7ade524dbd88bd250968f45e190af90e151fa5ee63dd6aa7f7bb90e8155db61d golangci-lint-1.61.0-freebsd-armv7.tar.gz
68+
0fe3cd8a1ed8d9f54f48670a5af3df056d6040d94017057f0f4d65c930660ad9 golangci-lint-1.61.0-illumos-amd64.tar.gz
69+
b463fc5053a612abd26393ebaff1d85d7d56058946f4f0f7bf25ed44ea899415 golangci-lint-1.61.0-linux-386.tar.gz
70+
77cb0af99379d9a21d5dc8c38364d060e864a01bd2f3e30b5e8cc550c3a54111 golangci-lint-1.61.0-linux-amd64.tar.gz
71+
af60ac05566d9351615cb31b4cc070185c25bf8cbd9b09c1873aa5ec6f3cc17e golangci-lint-1.61.0-linux-arm64.tar.gz
72+
1f307f2fcc5d7d674062a967a0d83a7091e300529aa237ec6ad2b3dd14c897f5 golangci-lint-1.61.0-linux-armv6.tar.gz
73+
3ad8cbaae75a547450844811300f99c4cd290277398e43d22b9eb1792d15af4c golangci-lint-1.61.0-linux-armv7.tar.gz
74+
9be2ca67d961d7699079739cf6f7c8291c5183d57e34d1677de21ca19d0bd3ed golangci-lint-1.61.0-linux-loong64.tar.gz
75+
90d005e1648115ebf0861b408eab9c936079a24763e883058b0a227cd3135d31 golangci-lint-1.61.0-linux-mips64.tar.gz
76+
6d2ed4f49407115460b8c10ccfc40fd177e0887a48864a2879dd16e84ba2a48c golangci-lint-1.61.0-linux-mips64le.tar.gz
77+
633089589af5a58b7430afb6eee107d4e9c99e8d91711ddc219eb13a07e8d3b8 golangci-lint-1.61.0-linux-ppc64le.tar.gz
78+
4c1a097d9e0d1b4a8144dae6a1f5583a38d662f3bdc1498c4e954b6ed856be98 golangci-lint-1.61.0-linux-riscv64.tar.gz
79+
30581d3c987d287b7064617f1a2694143e10dffc40bc25be6636006ee82d7e1c golangci-lint-1.61.0-linux-s390x.tar.gz
80+
42530bf8100bd43c07f5efe6d92148ba6c5a7a712d510c6f24be85af6571d5eb golangci-lint-1.61.0-netbsd-386.tar.gz
81+
b8bb07c920f6601edf718d5e82ec0784fd590b0992b42b6ec18da99f26013ed4 golangci-lint-1.61.0-netbsd-amd64.tar.gz
82+
353a51527c60bd0776b0891b03f247c791986f625fca689d121972c624e54198 golangci-lint-1.61.0-netbsd-arm64.tar.gz
83+
957a6272c3137910514225704c5dac0723b9c65eb7d9587366a997736e2d7580 golangci-lint-1.61.0-netbsd-armv6.tar.gz
84+
a89eb28ff7f18f5cd52b914739360fa95cf2f643de4adeca46e26bec3a07e8d8 golangci-lint-1.61.0-netbsd-armv7.tar.gz
85+
d8d74c43600b271393000717a4ed157d7a15bb85bab7db2efad9b63a694d4634 golangci-lint-1.61.0-windows-386.zip
86+
e7bc2a81929a50f830244d6d2e657cce4f19a59aff49fa9000176ff34fda64ce golangci-lint-1.61.0-windows-amd64.zip
87+
ed97c221596dd771e3dd9344872c140340bee2e819cd7a90afa1de752f1f2e0f golangci-lint-1.61.0-windows-arm64.zip
88+
4b365233948b13d02d45928a5c390045e00945e919747b9887b5f260247541ae golangci-lint-1.61.0-windows-armv6.zip
89+
595538fb64d152173959d28f6235227f9cd969a828e5af0c4e960d02af4ffd0e golangci-lint-1.61.0-windows-armv7.zip
9090

9191
# This is the builder on PPA that will build Go itself (inception-y), don't modify!
9292
#

cmd/devp2p/internal/ethtest/chain.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ func (c *Chain) AccountsInHashOrder() []state.DumpAccount {
100100
list := make([]state.DumpAccount, len(c.state))
101101
i := 0
102102
for addr, acc := range c.state {
103-
addr := addr
104103
list[i] = acc
105104
list[i].Address = &addr
106105
if len(acc.AddressHash) != 32 {

cmd/devp2p/internal/ethtest/snap.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ a key before startingHash (wrong order). The server should return the first avai
286286
}
287287

288288
for i, tc := range tests {
289-
tc := tc
290289
if i > 0 {
291290
t.Log("\n")
292291
}
@@ -429,7 +428,6 @@ of the test account. The server should return slots [2,3] (i.e. the 'next availa
429428
}
430429

431430
for i, tc := range tests {
432-
tc := tc
433431
if i > 0 {
434432
t.Log("\n")
435433
}
@@ -526,7 +524,6 @@ func (s *Suite) TestSnapGetByteCodes(t *utesting.T) {
526524
}
527525

528526
for i, tc := range tests {
529-
tc := tc
530527
if i > 0 {
531528
t.Log("\n")
532529
}
@@ -723,7 +720,6 @@ The server should reject the request.`,
723720
}
724721

725722
for i, tc := range tests {
726-
tc := tc
727723
if i > 0 {
728724
t.Log("\n")
729725
}

cmd/evm/t8n_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ func TestT9n(t *testing.T) {
524524
ok, err := cmpJson(have, want)
525525
switch {
526526
case err != nil:
527-
t.Logf(string(have))
527+
t.Log(string(have))
528528
t.Fatalf("test %d, json parsing failed: %v", i, err)
529529
case !ok:
530530
t.Fatalf("test %d: output wrong, have \n%v\nwant\n%v\n", i, string(have), string(want))
@@ -659,7 +659,7 @@ func TestB11r(t *testing.T) {
659659
ok, err := cmpJson(have, want)
660660
switch {
661661
case err != nil:
662-
t.Logf(string(have))
662+
t.Log(string(have))
663663
t.Fatalf("test %d, json parsing failed: %v", i, err)
664664
case !ok:
665665
t.Fatalf("test %d: output wrong, have \n%v\nwant\n%v\n", i, string(have), string(want))

cmd/geth/accountcmd_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ func TestAccountImport(t *testing.T) {
113113
},
114114
}
115115
for _, test := range tests {
116-
test := test
117116
t.Run(test.name, func(t *testing.T) {
118117
t.Parallel()
119118
importAccountWithExpect(t, test.key, test.output)

cmd/geth/consolecmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func remoteConsole(ctx *cli.Context) error {
152152
func ephemeralConsole(ctx *cli.Context) error {
153153
var b strings.Builder
154154
for _, file := range ctx.Args().Slice() {
155-
b.Write([]byte(fmt.Sprintf("loadScript('%s');", file)))
155+
b.WriteString(fmt.Sprintf("loadScript('%s');", file))
156156
}
157157
utils.Fatalf(`The "js" command is deprecated. Please use the following instead:
158158
geth --exec "%s" console`, b.String())

cmd/geth/version_check_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ func TestKeyID(t *testing.T) {
170170
{"third key", args{id: extractKeyId(gethPubKeys[2])}, "FD9813B2D2098484"},
171171
}
172172
for _, tt := range tests {
173-
tt := tt
174173
t.Run(tt.name, func(t *testing.T) {
175174
t.Parallel()
176175
if got := keyID(tt.args.id); got != tt.want {

cmd/rlpdump/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func dump(in *inStream, s *rlp.Stream, depth int, out io.Writer) error {
142142
s.List()
143143
defer s.ListEnd()
144144
if size == 0 {
145-
fmt.Fprintf(out, ws(depth)+"[]")
145+
fmt.Fprint(out, ws(depth)+"[]")
146146
} else {
147147
fmt.Fprintln(out, ws(depth)+"[")
148148
for i := 0; ; i++ {

cmd/utils/flags_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ func Test_SplitTagsFlag(t *testing.T) {
5656
},
5757
}
5858
for _, tt := range tests {
59-
tt := tt
6059
t.Run(tt.name, func(t *testing.T) {
6160
t.Parallel()
6261
if got := SplitTagsFlag(tt.args); !reflect.DeepEqual(got, tt.want) {

cmd/utils/prompt_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ func TestGetPassPhraseWithList(t *testing.T) {
6666
},
6767
}
6868
for _, tt := range tests {
69-
tt := tt
7069
t.Run(tt.name, func(t *testing.T) {
7170
t.Parallel()
7271
if got := GetPassPhraseWithList(tt.args.text, tt.args.confirmation, tt.args.index, tt.args.passwords); got != tt.want {

core/block_validator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error {
121121
// such as amount of used gas, the receipt roots and the state root itself.
122122
func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateDB, res *ProcessResult, stateless bool) error {
123123
if res == nil {
124-
return fmt.Errorf("nil ProcessResult value")
124+
return errors.New("nil ProcessResult value")
125125
}
126126
header := block.Header()
127127
if block.GasUsed() != res.GasUsed {
@@ -150,7 +150,7 @@ func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateD
150150
return fmt.Errorf("invalid requests hash (remote: %x local: %x)", *header.RequestsHash, reqhash)
151151
}
152152
} else if res.Requests != nil {
153-
return fmt.Errorf("block has requests before prague fork")
153+
return errors.New("block has requests before prague fork")
154154
}
155155
// Validate the state root against the received state root and throw
156156
// an error if they don't match.

core/rawdb/accessors_chain_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,10 @@ func TestBlockReceiptStorage(t *testing.T) {
388388
// Insert the receipt slice into the database and check presence
389389
WriteReceipts(db, hash, 0, receipts)
390390
if rs := ReadReceipts(db, hash, 0, 0, params.TestChainConfig); len(rs) == 0 {
391-
t.Fatalf("no receipts returned")
391+
t.Fatal("no receipts returned")
392392
} else {
393393
if err := checkReceiptsRLP(rs, receipts); err != nil {
394-
t.Fatalf(err.Error())
394+
t.Fatal(err)
395395
}
396396
}
397397
// Delete the body and ensure that the receipts are no longer returned (metadata can't be recomputed)
@@ -401,7 +401,7 @@ func TestBlockReceiptStorage(t *testing.T) {
401401
}
402402
// Ensure that receipts without metadata can be returned without the block body too
403403
if err := checkReceiptsRLP(ReadRawReceipts(db, hash, 0), receipts); err != nil {
404-
t.Fatalf(err.Error())
404+
t.Fatal(err)
405405
}
406406
// Sanity check that body alone without the receipt is a full purge
407407
WriteBody(db, hash, 0, body)

core/state/trie_prefetcher.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ func (sf *subfetcher) schedule(keys [][]byte, read bool) error {
282282
// Append the tasks to the current queue
283283
sf.lock.Lock()
284284
for _, key := range keys {
285-
key := key // closure for the append below
286285
sf.tasks = append(sf.tasks, &subfetcherTask{read: read, key: key})
287286
}
288287
sf.lock.Unlock()

core/types/transaction_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,9 +546,7 @@ func TestYParityJSONUnmarshalling(t *testing.T) {
546546
DynamicFeeTxType,
547547
BlobTxType,
548548
} {
549-
txType := txType
550549
for _, test := range tests {
551-
test := test
552550
t.Run(fmt.Sprintf("txType=%d: %s", txType, test.name), func(t *testing.T) {
553551
// Copy the base json
554552
testJson := maps.Clone(baseJson)

core/vm/errors.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (e ErrStackUnderflow) Error() string {
5656
}
5757

5858
func (e ErrStackUnderflow) Unwrap() error {
59-
return fmt.Errorf("stack underflow")
59+
return errors.New("stack underflow")
6060
}
6161

6262
// ErrStackOverflow wraps an evm error when the items on the stack exceeds
@@ -71,7 +71,7 @@ func (e ErrStackOverflow) Error() string {
7171
}
7272

7373
func (e ErrStackOverflow) Unwrap() error {
74-
return fmt.Errorf("stack overflow")
74+
return errors.New("stack overflow")
7575
}
7676

7777
// ErrInvalidOpCode wraps an evm error when an invalid opcode is encountered.

eth/downloader/downloader.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,6 @@ func (d *Downloader) spawnSync(fetchers []func() error) error {
541541
errc := make(chan error, len(fetchers))
542542
d.cancelWg.Add(len(fetchers))
543543
for _, fn := range fetchers {
544-
fn := fn
545544
go func() { defer d.cancelWg.Done(); errc <- fn() }()
546545
}
547546
// Wait for the first error, then terminate the others.

eth/filters/api.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ func (api *FilterAPI) Logs(ctx context.Context, crit FilterCriteria) (*rpc.Subsc
273273
select {
274274
case logs := <-matchedLogs:
275275
for _, log := range logs {
276-
log := log
277276
notifier.Notify(rpcSub.ID, &log)
278277
}
279278
case <-rpcSub.Err(): // client send an unsubscribe request

eth/handler_eth_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,6 @@ func testTransactionPropagation(t *testing.T, protocol uint) {
390390
}
391391
// Interconnect all the sink handlers with the source handler
392392
for i, sink := range sinks {
393-
sink := sink // Closure for goroutine below
394-
395393
sourcePipe, sinkPipe := p2p.MsgPipe()
396394
defer sourcePipe.Close()
397395
defer sinkPipe.Close()

eth/protocols/eth/handler.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ type TxPool interface {
9393
func MakeProtocols(backend Backend, network uint64, dnsdisc enode.Iterator) []p2p.Protocol {
9494
protocols := make([]p2p.Protocol, 0, len(ProtocolVersions))
9595
for _, version := range ProtocolVersions {
96-
version := version // Closure
97-
9896
protocols = append(protocols, p2p.Protocol{
9997
Name: ProtocolName,
10098
Version: version,

eth/protocols/snap/handler.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ type Backend interface {
8585
func MakeProtocols(backend Backend) []p2p.Protocol {
8686
protocols := make([]p2p.Protocol, len(ProtocolVersions))
8787
for i, version := range ProtocolVersions {
88-
version := version // Closure
89-
9088
protocols[i] = p2p.Protocol{
9189
Name: ProtocolName,
9290
Version: version,

0 commit comments

Comments
 (0)