Skip to content

Commit 533dc37

Browse files
committed
all: fix issues found by linters
1 parent 3dc38f6 commit 533dc37

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ linters:
2121
- staticcheck
2222
- bidichk
2323
- durationcheck
24-
- exportloopref
24+
- copyloopvar
2525
- whitespace
2626
- revive # only certain checks enabled
2727

accounts/abi/unpack_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ func TestOOMMaliciousInput(t *testing.T) {
947947
}
948948
encb, err := hex.DecodeString(test.enc)
949949
if err != nil {
950-
t.Fatalf("invalid hex: %s" + test.enc)
950+
t.Fatalf("invalid hex: %s", test.enc)
951951
}
952952
_, err = abi.Methods["method"].Outputs.UnpackValues(encb)
953953
if err == nil {

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/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++ {

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)

eth/tracers/logger/logger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ func formatLogs(logs []StructLog) []StructLogRes {
458458
}
459459
formatted[index].Stack = &stack
460460
}
461-
if trace.ReturnData != nil && len(trace.ReturnData) > 0 {
461+
if len(trace.ReturnData) > 0 {
462462
formatted[index].ReturnData = hexutil.Bytes(trace.ReturnData).String()
463463
}
464464
if trace.Memory != nil {

metrics/json_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func TestRegistryMarshallJSON(t *testing.T) {
1313
r.Register("counter", NewCounter())
1414
enc.Encode(r)
1515
if s := b.String(); s != "{\"counter\":{\"count\":0}}\n" {
16-
t.Fatalf(s)
16+
t.Fatal(s)
1717
}
1818
}
1919

0 commit comments

Comments
 (0)