Skip to content

Commit 44b4164

Browse files
fjlkaralabe
authored andcommitted
rlp: fix staticcheck warnings (#20368)
* rlp: fix staticcheck warnings * rlp: fix ExampleDecode test
1 parent 9ef90db commit 44b4164

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

rlp/decode.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ import (
2929
"sync"
3030
)
3131

32-
var (
33-
// EOL is returned when the end of the current list
34-
// has been reached during streaming.
35-
EOL = errors.New("rlp: end of list")
32+
//lint:ignore ST1012 EOL is not an error.
33+
34+
// EOL is returned when the end of the current list
35+
// has been reached during streaming.
36+
var EOL = errors.New("rlp: end of list")
3637

37-
// Actual Errors
38+
var (
3839
ErrExpectedString = errors.New("rlp: expected String or Byte")
3940
ErrExpectedList = errors.New("rlp: expected List")
4041
ErrCanonInt = errors.New("rlp: non-canonical integer format")

rlp/decode_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ type tailUint struct {
354354
type tailPrivateFields struct {
355355
A uint
356356
Tail []uint `rlp:"tail"`
357-
x, y bool
357+
x, y bool //lint:ignore U1000 unused fields required for testing purposes.
358358
}
359359

360360
type nilListUint struct {
@@ -806,9 +806,8 @@ func ExampleDecode() {
806806
input, _ := hex.DecodeString("C90A1486666F6F626172")
807807

808808
type example struct {
809-
A, B uint
810-
private uint // private fields are ignored
811-
String string
809+
A, B uint
810+
String string
812811
}
813812

814813
var s example
@@ -819,7 +818,7 @@ func ExampleDecode() {
819818
fmt.Printf("Decoded value: %#v\n", s)
820819
}
821820
// Output:
822-
// Decoded value: rlp.example{A:0xa, B:0x14, private:0x0, String:"foobar"}
821+
// Decoded value: rlp.example{A:0xa, B:0x14, String:"foobar"}
823822
}
824823

825824
func ExampleDecode_structTagNil() {

0 commit comments

Comments
 (0)