Help us shape the future of Go! Take the 2026 Go Developer Survey

decodingutil

package
v2.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const MaxDepth = 10000

MaxDepth limits the nesting of arrays, maps and structs while decoding. Without it, deeply nested input exhausts the goroutine stack and the runtime aborts with a fatal error that cannot be recovered.

Variables

View Source
var ErrDeclaredLengthTooLarge = errors.New("declared length is too large")

ErrDeclaredLengthTooLarge is returned when a declared 32-bit length cannot be represented as a non-negative int (32-bit platforms).

Functions

func CheckMapKey

func CheckMapKey(key interface{}) error

CheckMapKey reports an error when key would panic as a map key.

func CheckMapKeyValue

func CheckMapKeyValue(key reflect.Value) error

CheckMapKeyValue is the reflect.Value variant of CheckMapKey.

func DepthError

func DepthError() error

DepthError reports that the nesting limit was exceeded.

func IsExtCode

func IsExtCode(code byte) bool

IsExtCode reports whether code starts an ext value. Map keys decoded from ext values come from user-provided decoders and may be unhashable, while other non-container codes always yield hashable values.

func LengthFromUint32 added in v2.4.4

func LengthFromUint32(u uint32) (int, error)

LengthFromUint32 converts a MessagePack-declared 32-bit length to int, rejecting values that are not representable as a non-negative int.

func MapKeyNeedsCheck

func MapKeyNeedsCheck(t reflect.Type) bool

MapKeyNeedsCheck reports whether a concrete map key type t may still hold unhashable values at runtime (e.g. a struct with an interface field). Interface key types are handled separately by the decoders.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL