mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
all: fix issues found by linters
This commit is contained in:
parent
3dc38f6be4
commit
533dc37de6
7 changed files with 10 additions and 10 deletions
|
|
@ -21,7 +21,7 @@ linters:
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- bidichk
|
- bidichk
|
||||||
- durationcheck
|
- durationcheck
|
||||||
- exportloopref
|
- copyloopvar
|
||||||
- whitespace
|
- whitespace
|
||||||
- revive # only certain checks enabled
|
- revive # only certain checks enabled
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -947,7 +947,7 @@ func TestOOMMaliciousInput(t *testing.T) {
|
||||||
}
|
}
|
||||||
encb, err := hex.DecodeString(test.enc)
|
encb, err := hex.DecodeString(test.enc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("invalid hex: %s" + test.enc)
|
t.Fatalf("invalid hex: %s", test.enc)
|
||||||
}
|
}
|
||||||
_, err = abi.Methods["method"].Outputs.UnpackValues(encb)
|
_, err = abi.Methods["method"].Outputs.UnpackValues(encb)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
|
||||||
|
|
@ -524,7 +524,7 @@ func TestT9n(t *testing.T) {
|
||||||
ok, err := cmpJson(have, want)
|
ok, err := cmpJson(have, want)
|
||||||
switch {
|
switch {
|
||||||
case err != nil:
|
case err != nil:
|
||||||
t.Logf(string(have))
|
t.Log(string(have))
|
||||||
t.Fatalf("test %d, json parsing failed: %v", i, err)
|
t.Fatalf("test %d, json parsing failed: %v", i, err)
|
||||||
case !ok:
|
case !ok:
|
||||||
t.Fatalf("test %d: output wrong, have \n%v\nwant\n%v\n", i, string(have), string(want))
|
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) {
|
||||||
ok, err := cmpJson(have, want)
|
ok, err := cmpJson(have, want)
|
||||||
switch {
|
switch {
|
||||||
case err != nil:
|
case err != nil:
|
||||||
t.Logf(string(have))
|
t.Log(string(have))
|
||||||
t.Fatalf("test %d, json parsing failed: %v", i, err)
|
t.Fatalf("test %d, json parsing failed: %v", i, err)
|
||||||
case !ok:
|
case !ok:
|
||||||
t.Fatalf("test %d: output wrong, have \n%v\nwant\n%v\n", i, string(have), string(want))
|
t.Fatalf("test %d: output wrong, have \n%v\nwant\n%v\n", i, string(have), string(want))
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ func dump(in *inStream, s *rlp.Stream, depth int, out io.Writer) error {
|
||||||
s.List()
|
s.List()
|
||||||
defer s.ListEnd()
|
defer s.ListEnd()
|
||||||
if size == 0 {
|
if size == 0 {
|
||||||
fmt.Fprintf(out, ws(depth)+"[]")
|
fmt.Fprint(out, ws(depth)+"[]")
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintln(out, ws(depth)+"[")
|
fmt.Fprintln(out, ws(depth)+"[")
|
||||||
for i := 0; ; i++ {
|
for i := 0; ; i++ {
|
||||||
|
|
|
||||||
|
|
@ -388,10 +388,10 @@ func TestBlockReceiptStorage(t *testing.T) {
|
||||||
// Insert the receipt slice into the database and check presence
|
// Insert the receipt slice into the database and check presence
|
||||||
WriteReceipts(db, hash, 0, receipts)
|
WriteReceipts(db, hash, 0, receipts)
|
||||||
if rs := ReadReceipts(db, hash, 0, 0, params.TestChainConfig); len(rs) == 0 {
|
if rs := ReadReceipts(db, hash, 0, 0, params.TestChainConfig); len(rs) == 0 {
|
||||||
t.Fatalf("no receipts returned")
|
t.Fatal("no receipts returned")
|
||||||
} else {
|
} else {
|
||||||
if err := checkReceiptsRLP(rs, receipts); err != nil {
|
if err := checkReceiptsRLP(rs, receipts); err != nil {
|
||||||
t.Fatalf(err.Error())
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Delete the body and ensure that the receipts are no longer returned (metadata can't be recomputed)
|
// 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) {
|
||||||
}
|
}
|
||||||
// Ensure that receipts without metadata can be returned without the block body too
|
// Ensure that receipts without metadata can be returned without the block body too
|
||||||
if err := checkReceiptsRLP(ReadRawReceipts(db, hash, 0), receipts); err != nil {
|
if err := checkReceiptsRLP(ReadRawReceipts(db, hash, 0), receipts); err != nil {
|
||||||
t.Fatalf(err.Error())
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
// Sanity check that body alone without the receipt is a full purge
|
// Sanity check that body alone without the receipt is a full purge
|
||||||
WriteBody(db, hash, 0, body)
|
WriteBody(db, hash, 0, body)
|
||||||
|
|
|
||||||
|
|
@ -458,7 +458,7 @@ func formatLogs(logs []StructLog) []StructLogRes {
|
||||||
}
|
}
|
||||||
formatted[index].Stack = &stack
|
formatted[index].Stack = &stack
|
||||||
}
|
}
|
||||||
if trace.ReturnData != nil && len(trace.ReturnData) > 0 {
|
if len(trace.ReturnData) > 0 {
|
||||||
formatted[index].ReturnData = hexutil.Bytes(trace.ReturnData).String()
|
formatted[index].ReturnData = hexutil.Bytes(trace.ReturnData).String()
|
||||||
}
|
}
|
||||||
if trace.Memory != nil {
|
if trace.Memory != nil {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ func TestRegistryMarshallJSON(t *testing.T) {
|
||||||
r.Register("counter", NewCounter())
|
r.Register("counter", NewCounter())
|
||||||
enc.Encode(r)
|
enc.Encode(r)
|
||||||
if s := b.String(); s != "{\"counter\":{\"count\":0}}\n" {
|
if s := b.String(); s != "{\"counter\":{\"count\":0}}\n" {
|
||||||
t.Fatalf(s)
|
t.Fatal(s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue