build: upgrade to go 1.19 (#25726)
This changes the CI / release builds to use the latest Go version. It also upgrades golangci-lint to a newer version compatible with Go 1.19. In Go 1.19, godoc has gained official support for links and lists. The syntax for code blocks in doc comments has changed and now requires a leading tab character. gofmt adapts comments to the new syntax automatically, so there are a lot of comment re-formatting changes in this PR. We need to apply the new format in order to pass the CI lint stage with Go 1.19. With the linter upgrade, I have decided to disable 'gosec' - it produces too many false-positive warnings. The 'deadcode' and 'varcheck' linters have also been removed because golangci-lint warns about them being unmaintained. 'unused' provides similar coverage and we already have it enabled, so we don't lose much with this change.
This commit is contained in:
+1
-1
@@ -76,7 +76,7 @@ type Decoder interface {
|
||||
// Note that Decode does not set an input limit for all readers and may be vulnerable to
|
||||
// panics cause by huge value sizes. If you need an input limit, use
|
||||
//
|
||||
// NewStream(r, limit).Decode(val)
|
||||
// NewStream(r, limit).Decode(val)
|
||||
func Decode(r io.Reader, val interface{}) error {
|
||||
stream := streamPool.Get().(*Stream)
|
||||
defer streamPool.Put(stream)
|
||||
|
||||
+21
-24
@@ -27,8 +27,7 @@ value zero equivalent to the empty string).
|
||||
RLP values are distinguished by a type tag. The type tag precedes the value in the input
|
||||
stream and defines the size and kind of the bytes that follow.
|
||||
|
||||
|
||||
Encoding Rules
|
||||
# Encoding Rules
|
||||
|
||||
Package rlp uses reflection and encodes RLP based on the Go type of the value.
|
||||
|
||||
@@ -58,8 +57,7 @@ An interface value encodes as the value contained in the interface.
|
||||
|
||||
Floating point numbers, maps, channels and functions are not supported.
|
||||
|
||||
|
||||
Decoding Rules
|
||||
# Decoding Rules
|
||||
|
||||
Decoding uses the following type-dependent rules:
|
||||
|
||||
@@ -93,30 +91,29 @@ or one (true).
|
||||
|
||||
To decode into an interface value, one of these types is stored in the value:
|
||||
|
||||
[]interface{}, for RLP lists
|
||||
[]byte, for RLP strings
|
||||
[]interface{}, for RLP lists
|
||||
[]byte, for RLP strings
|
||||
|
||||
Non-empty interface types are not supported when decoding.
|
||||
Signed integers, floating point numbers, maps, channels and functions cannot be decoded into.
|
||||
|
||||
|
||||
Struct Tags
|
||||
# Struct Tags
|
||||
|
||||
As with other encoding packages, the "-" tag ignores fields.
|
||||
|
||||
type StructWithIgnoredField struct{
|
||||
Ignored uint `rlp:"-"`
|
||||
Field uint
|
||||
}
|
||||
type StructWithIgnoredField struct{
|
||||
Ignored uint `rlp:"-"`
|
||||
Field uint
|
||||
}
|
||||
|
||||
Go struct values encode/decode as RLP lists. There are two ways of influencing the mapping
|
||||
of fields to list elements. The "tail" tag, which may only be used on the last exported
|
||||
struct field, allows slurping up any excess list elements into a slice.
|
||||
|
||||
type StructWithTail struct{
|
||||
Field uint
|
||||
Tail []string `rlp:"tail"`
|
||||
}
|
||||
type StructWithTail struct{
|
||||
Field uint
|
||||
Tail []string `rlp:"tail"`
|
||||
}
|
||||
|
||||
The "optional" tag says that the field may be omitted if it is zero-valued. If this tag is
|
||||
used on a struct field, all subsequent public fields must also be declared optional.
|
||||
@@ -128,11 +125,11 @@ When decoding into a struct, optional fields may be omitted from the end of the
|
||||
list. For the example below, this means input lists of one, two, or three elements are
|
||||
accepted.
|
||||
|
||||
type StructWithOptionalFields struct{
|
||||
Required uint
|
||||
Optional1 uint `rlp:"optional"`
|
||||
Optional2 uint `rlp:"optional"`
|
||||
}
|
||||
type StructWithOptionalFields struct{
|
||||
Required uint
|
||||
Optional1 uint `rlp:"optional"`
|
||||
Optional2 uint `rlp:"optional"`
|
||||
}
|
||||
|
||||
The "nil", "nilList" and "nilString" tags apply to pointer-typed fields only, and change
|
||||
the decoding rules for the field type. For regular pointer fields without the "nil" tag,
|
||||
@@ -140,9 +137,9 @@ input values must always match the required input length exactly and the decoder
|
||||
produce nil values. When the "nil" tag is set, input values of size zero decode as a nil
|
||||
pointer. This is especially useful for recursive types.
|
||||
|
||||
type StructWithNilField struct {
|
||||
Field *[3]byte `rlp:"nil"`
|
||||
}
|
||||
type StructWithNilField struct {
|
||||
Field *[3]byte `rlp:"nil"`
|
||||
}
|
||||
|
||||
In the example above, Field allows two possible input sizes. For input 0xC180 (a list
|
||||
containing an empty string) Field is set to nil after decoding. For input 0xC483000000 (a
|
||||
|
||||
Reference in New Issue
Block a user