rlp: undo golint comment changes

This commit is contained in:
Felix Lange 2018-05-07 13:57:15 +02:00
parent 981017754e
commit f2431ebc91
2 changed files with 20 additions and 34 deletions

View file

@ -26,10 +26,26 @@ import (
"math/big" "math/big"
"reflect" "reflect"
"strings" "strings"
customErr "github.com/pkg/errors"
) )
var ( var (
// EOL is returned when the end of the current list
// has been reached during streaming.
EOL = errors.New("rlp: end of list")
// Actual Errors
ErrExpectedString = errors.New("rlp: expected String or Byte")
ErrExpectedList = errors.New("rlp: expected List")
ErrCanonInt = errors.New("rlp: non-canonical integer format")
ErrCanonSize = errors.New("rlp: non-canonical size information")
ErrElemTooLarge = errors.New("rlp: element is larger than containing list")
ErrValueTooLarge = errors.New("rlp: value size exceeds available input length")
ErrMoreThanOneValue = errors.New("rlp: input contains more than one value")
// internal errors
errNotInList = errors.New("rlp: call of ListEnd outside of any list")
errNotAtEOL = errors.New("rlp: call of ListEnd not positioned at EOL")
errUintOverflow = errors.New("rlp: uint overflow")
errNoPointer = errors.New("rlp: interface given to Decode must be a pointer") errNoPointer = errors.New("rlp: interface given to Decode must be a pointer")
errDecodeIntoNil = errors.New("rlp: pointer given to Decode must not be nil") errDecodeIntoNil = errors.New("rlp: pointer given to Decode must not be nil")
) )
@ -536,8 +552,6 @@ func decodeDecoder(s *Stream, val reflect.Value) error {
// Kind represents the kind of value contained in an RLP stream. // Kind represents the kind of value contained in an RLP stream.
type Kind int type Kind int
// Const list indicates the kind of value in an RLP stream
// and its next value is incremented by Kind().
const ( const (
Byte Kind = iota Byte Kind = iota
String String
@ -557,34 +571,6 @@ func (k Kind) String() string {
} }
} }
var (
// EOL is returned when the end of the current list
// has been reached during streaming.
EOL = customErr.New(fmt.Sprintf("rlp: end of list"))
//ActualErrors
//ErrExpectedString is returned if kind is not string or Byte.
ErrExpectedString = errors.New("rlp: expected String or Byte")
//ErrExpectedList is returned if kind is not a list.
ErrExpectedList = errors.New("rlp: expected List")
//ErrCanonInt is returned if integer is a non-canonical format .
ErrCanonInt = errors.New("rlp: non-canonical integer format")
//ErrCanonSize is returned if integer has non-canonical size information.
ErrCanonSize = errors.New("rlp: non-canonical size information")
//ErrElemTooLarge is returned if the element is larger than the list.
ErrElemTooLarge = errors.New("rlp: element is larger than containing list")
//ErrValueTooLarge is returned if the element is larger than available input length.
ErrValueTooLarge = errors.New("rlp: value size exceeds available input length")
//ErrMoreThanOneValue is reported by DecodeBytes if the slice contains additional data after the first RLP value.
ErrMoreThanOneValue = errors.New("rlp: input contains more than one value")
// internal errors
errNotInList = errors.New("rlp: call of ListEnd outside of any list")
errNotAtEOL = errors.New("rlp: call of ListEnd not positioned at EOL")
errUintOverflow = errors.New("rlp: uint overflow")
)
// ByteReader must be implemented by any input reader for a Stream. It // ByteReader must be implemented by any input reader for a Stream. It
// is implemented by e.g. bufio.Reader and bytes.Reader. // is implemented by e.g. bufio.Reader and bytes.Reader.
type ByteReader interface { type ByteReader interface {

View file

@ -25,9 +25,9 @@ import (
) )
var ( var (
//EmptyString accepts a common encoded value useful for implementing EncodeRLP. // Common encoded values.
// These are useful when implementing EncodeRLP.
EmptyString = []byte{0x80} EmptyString = []byte{0x80}
//EmptyList accepts a common encoded value useful for implementing EncodeRLP.
EmptyList = []byte{0xC0} EmptyList = []byte{0xC0}
) )
@ -217,7 +217,7 @@ func (w *encbuf) list() *listhead {
func (w *encbuf) listEnd(lh *listhead) { func (w *encbuf) listEnd(lh *listhead) {
lh.size = w.size() - lh.offset - lh.size lh.size = w.size() - lh.offset - lh.size
if lh.size < 56 { if lh.size < 56 {
w.lhsize ++ // length encoded into kind tag w.lhsize++ // length encoded into kind tag
} else { } else {
w.lhsize += 1 + intsize(uint64(lh.size)) w.lhsize += 1 + intsize(uint64(lh.size))
} }