Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
rlp: fix staticcheck warnings (ethereum#20368)
Browse files Browse the repository at this point in the history
* rlp: fix staticcheck warnings

* rlp: fix ExampleDecode test
  • Loading branch information
fjl authored and elizabethengelman committed Dec 20, 2019
1 parent a9acff7 commit d25502d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
11 changes: 6 additions & 5 deletions rlp/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ import (
"sync"
)

var (
// EOL is returned when the end of the current list
// has been reached during streaming.
EOL = errors.New("rlp: end of list")
//lint:ignore ST1012 EOL is not an error.

// EOL is returned when the end of the current list
// has been reached during streaming.
var EOL = errors.New("rlp: end of list")

// Actual Errors
var (
ErrExpectedString = errors.New("rlp: expected String or Byte")
ErrExpectedList = errors.New("rlp: expected List")
ErrCanonInt = errors.New("rlp: non-canonical integer format")
Expand Down
9 changes: 4 additions & 5 deletions rlp/decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ type tailUint struct {
type tailPrivateFields struct {
A uint
Tail []uint `rlp:"tail"`
x, y bool
x, y bool //lint:ignore U1000 unused fields required for testing purposes.
}

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

type example struct {
A, B uint
private uint // private fields are ignored
String string
A, B uint
String string
}

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

func ExampleDecode_structTagNil() {
Expand Down

0 comments on commit d25502d

Please sign in to comment.