@@ -29,6 +29,23 @@ import (
2929)
3030
3131var (
32+ // EOL is returned when the end of the current list
33+ // has been reached during streaming.
34+ EOL = errors .New ("rlp: end of list" )
35+
36+ // Actual Errors
37+ ErrExpectedString = errors .New ("rlp: expected String or Byte" )
38+ ErrExpectedList = errors .New ("rlp: expected List" )
39+ ErrCanonInt = errors .New ("rlp: non-canonical integer format" )
40+ ErrCanonSize = errors .New ("rlp: non-canonical size information" )
41+ ErrElemTooLarge = errors .New ("rlp: element is larger than containing list" )
42+ ErrValueTooLarge = errors .New ("rlp: value size exceeds available input length" )
43+ ErrMoreThanOneValue = errors .New ("rlp: input contains more than one value" )
44+
45+ // internal errors
46+ errNotInList = errors .New ("rlp: call of ListEnd outside of any list" )
47+ errNotAtEOL = errors .New ("rlp: call of ListEnd not positioned at EOL" )
48+ errUintOverflow = errors .New ("rlp: uint overflow" )
3249 errNoPointer = errors .New ("rlp: interface given to Decode must be a pointer" )
3350 errDecodeIntoNil = errors .New ("rlp: pointer given to Decode must not be nil" )
3451)
@@ -274,9 +291,8 @@ func makeListDecoder(typ reflect.Type, tag tags) (decoder, error) {
274291 if etype .Kind () == reflect .Uint8 && ! reflect .PtrTo (etype ).Implements (decoderInterface ) {
275292 if typ .Kind () == reflect .Array {
276293 return decodeByteArray , nil
277- } else {
278- return decodeByteSlice , nil
279294 }
295+ return decodeByteSlice , nil
280296 }
281297 etypeinfo , err := cachedTypeInfo1 (etype , tags {})
282298 if err != nil {
@@ -555,29 +571,6 @@ func (k Kind) String() string {
555571 }
556572}
557573
558- var (
559- // EOL is returned when the end of the current list
560- // has been reached during streaming.
561- EOL = errors .New ("rlp: end of list" )
562-
563- // Actual Errors
564- ErrExpectedString = errors .New ("rlp: expected String or Byte" )
565- ErrExpectedList = errors .New ("rlp: expected List" )
566- ErrCanonInt = errors .New ("rlp: non-canonical integer format" )
567- ErrCanonSize = errors .New ("rlp: non-canonical size information" )
568- ErrElemTooLarge = errors .New ("rlp: element is larger than containing list" )
569- ErrValueTooLarge = errors .New ("rlp: value size exceeds available input length" )
570-
571- // This error is reported by DecodeBytes if the slice contains
572- // additional data after the first RLP value.
573- ErrMoreThanOneValue = errors .New ("rlp: input contains more than one value" )
574-
575- // internal errors
576- errNotInList = errors .New ("rlp: call of ListEnd outside of any list" )
577- errNotAtEOL = errors .New ("rlp: call of ListEnd not positioned at EOL" )
578- errUintOverflow = errors .New ("rlp: uint overflow" )
579- )
580-
581574// ByteReader must be implemented by any input reader for a Stream. It
582575// is implemented by e.g. bufio.Reader and bytes.Reader.
583576type ByteReader interface {
0 commit comments