tests

package module
v0.0.0-...-8c1a6aa Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

This file exercises top-level empty-interface type declarations: the generator must skip `type X any` exactly like `type X interface{}` (methods cannot be generated for an interface receiver, and the IDENT/Intf fallbacks emit code that does not compile), while ordinary types declared alongside them still generate.

This file exercises the maxtotalbytes directive, which gives a named slice type the same tight MaxSize bound that the maxtotalbytes= field tag gives a struct field.

Package tests exercises the `required` codec struct-tag option, which makes the generated decoder reject any field that holds its zero value after decoding (whether the field was absent from the wire or encoded as zero).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyDeclNeighborMaxSize

func AnyDeclNeighborMaxSize() (s int)

AnyDeclNeighborMaxSize returns a maximum valid message size for this message type

func ArgsHolderMaxSize

func ArgsHolderMaxSize() (s int)

ArgsHolderMaxSize returns a maximum valid message size for this message type

func BoundedArgsMaxSize

func BoundedArgsMaxSize() (s int)

BoundedArgsMaxSize returns a maximum valid message size for this message type

func CompositeRequiredMaxSize

func CompositeRequiredMaxSize() (s int)

CompositeRequiredMaxSize returns a maximum valid message size for this message type

func InnerMaxSize

func InnerMaxSize() (s int)

InnerMaxSize returns a maximum valid message size for this message type

func MapRequiredMaxSize

func MapRequiredMaxSize() (s int)

MapRequiredMaxSize returns a maximum valid message size for this message type

func MapRequiredOmitEmptyMaxSize

func MapRequiredOmitEmptyMaxSize() (s int)

MapRequiredOmitEmptyMaxSize returns a maximum valid message size for this message type

func TotalBoundedArgsMaxSize

func TotalBoundedArgsMaxSize() (s int)

TotalBoundedArgsMaxSize returns a maximum valid message size for this message type

func TupleRequiredMaxSize

func TupleRequiredMaxSize() (s int)

TupleRequiredMaxSize returns a maximum valid message size for this message type

Types

type AnyDeclNeighbor

type AnyDeclNeighbor struct {
	Name  string `codec:"n"`
	Count uint64 `codec:"c"`
	// contains filtered or unexported fields
}

AnyDeclNeighbor must still get generated code despite the interface declarations surrounding it.

func (*AnyDeclNeighbor) CanMarshalMsg

func (_ *AnyDeclNeighbor) CanMarshalMsg(z interface{}) bool

func (*AnyDeclNeighbor) CanUnmarshalMsg

func (_ *AnyDeclNeighbor) CanUnmarshalMsg(z interface{}) bool

func (*AnyDeclNeighbor) MarshalMsg

func (z *AnyDeclNeighbor) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*AnyDeclNeighbor) MsgIsZero

func (z *AnyDeclNeighbor) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*AnyDeclNeighbor) Msgsize

func (z *AnyDeclNeighbor) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AnyDeclNeighbor) UnmarshalMsg

func (z *AnyDeclNeighbor) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*AnyDeclNeighbor) UnmarshalMsgWithState

func (z *AnyDeclNeighbor) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ArgsHolder

type ArgsHolder struct {
	Args TotalBoundedArgs `codec:"a"`
	// contains filtered or unexported fields
}

ArgsHolder holds TotalBoundedArgs, and should use its MaxSize.

func (*ArgsHolder) CanMarshalMsg

func (_ *ArgsHolder) CanMarshalMsg(z interface{}) bool

func (*ArgsHolder) CanUnmarshalMsg

func (_ *ArgsHolder) CanUnmarshalMsg(z interface{}) bool

func (*ArgsHolder) MarshalMsg

func (z *ArgsHolder) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*ArgsHolder) MsgIsZero

func (z *ArgsHolder) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*ArgsHolder) Msgsize

func (z *ArgsHolder) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ArgsHolder) UnmarshalMsg

func (z *ArgsHolder) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*ArgsHolder) UnmarshalMsgWithState

func (z *ArgsHolder) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BoundedArgs

type BoundedArgs [][]byte

BoundedArgs has only allocbounds, so its MaxSize is the product of them.

func (BoundedArgs) CanMarshalMsg

func (_ BoundedArgs) CanMarshalMsg(z interface{}) bool

func (*BoundedArgs) CanUnmarshalMsg

func (_ *BoundedArgs) CanUnmarshalMsg(z interface{}) bool

func (BoundedArgs) MarshalMsg

func (z BoundedArgs) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (BoundedArgs) MsgIsZero

func (z BoundedArgs) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (BoundedArgs) Msgsize

func (z BoundedArgs) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*BoundedArgs) UnmarshalMsg

func (z *BoundedArgs) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*BoundedArgs) UnmarshalMsgWithState

func (z *BoundedArgs) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type CompositeRequired

type CompositeRequired struct {
	Nested Inner `codec:"nested,required"` // zero when Inner is zero (X == "")
	// contains filtered or unexported fields
}

CompositeRequired covers required on a non-scalar field, whose zero check is derived from the type rather than a literal: a value struct is zero when all of its fields are zero.

func (*CompositeRequired) CanMarshalMsg

func (_ *CompositeRequired) CanMarshalMsg(z interface{}) bool

func (*CompositeRequired) CanUnmarshalMsg

func (_ *CompositeRequired) CanUnmarshalMsg(z interface{}) bool

func (*CompositeRequired) MarshalMsg

func (z *CompositeRequired) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*CompositeRequired) MsgIsZero

func (z *CompositeRequired) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*CompositeRequired) Msgsize

func (z *CompositeRequired) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*CompositeRequired) UnmarshalMsg

func (z *CompositeRequired) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*CompositeRequired) UnmarshalMsgWithState

func (z *CompositeRequired) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type HandleAny

type HandleAny any

HandleAny is an opaque reference in the style of go-algorand's agreement.MessageHandle and network.Peer; no methods may be generated.

type HandleAnyAlias

type HandleAnyAlias = any

HandleAnyAlias is the alias form of the same declaration.

type HandleIface

type HandleIface interface{}

HandleIface is the pre-Go-1.18 spelling of HandleAny.

type Inner

type Inner struct {
	X string `codec:"x,omitempty"`
	// contains filtered or unexported fields
}

Inner is a named struct used to exercise required on composite fields.

func (*Inner) CanMarshalMsg

func (_ *Inner) CanMarshalMsg(z interface{}) bool

func (*Inner) CanUnmarshalMsg

func (_ *Inner) CanUnmarshalMsg(z interface{}) bool

func (*Inner) MarshalMsg

func (z *Inner) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*Inner) MsgIsZero

func (z *Inner) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*Inner) Msgsize

func (z *Inner) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Inner) UnmarshalMsg

func (z *Inner) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*Inner) UnmarshalMsgWithState

func (z *Inner) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MapRequired

type MapRequired struct {

	// Required, not omitempty: a zero value is written to the wire and must
	// still be rejected on decode.
	ReqPlain string `codec:"reqplain,required"`

	// Required and omitempty: a zero value is dropped by the encoder, leaving
	// the field absent on decode, and must still be rejected.
	ReqOmit int64 `codec:"reqomit,omitempty,required"`

	// Not required: a zero value decodes without error.
	Optional string `codec:"opt,omitempty"`
	// contains filtered or unexported fields
}

MapRequired covers the required option on a map-encoded struct. Its _struct tag carries no omitempty, so a zero required field is still written to the wire (the "present but zero" rejection path); a field that individually opts into omitempty is instead dropped when zero (the "absent from the wire" path).

func (*MapRequired) CanMarshalMsg

func (_ *MapRequired) CanMarshalMsg(z interface{}) bool

func (*MapRequired) CanUnmarshalMsg

func (_ *MapRequired) CanUnmarshalMsg(z interface{}) bool

func (*MapRequired) MarshalMsg

func (z *MapRequired) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*MapRequired) MsgIsZero

func (z *MapRequired) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*MapRequired) Msgsize

func (z *MapRequired) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MapRequired) UnmarshalMsg

func (z *MapRequired) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*MapRequired) UnmarshalMsgWithState

func (z *MapRequired) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MapRequiredOmitEmpty

type MapRequiredOmitEmpty struct {

	// Required with struct-level (not field-level) omitempty: a zero value is
	// still dropped by the encoder, leaving the field absent on decode.
	Req string `codec:"req,required"`

	// Not required.
	Optional string `codec:"opt"`
	// contains filtered or unexported fields
}

MapRequiredOmitEmpty has the same shape as MapRequired but its _struct tag carries omitempty, so struct-level omitempty applies to every field. A zero required field is dropped from the wire entirely (rather than written as zero) and must still be rejected on decode.

func (*MapRequiredOmitEmpty) CanMarshalMsg

func (_ *MapRequiredOmitEmpty) CanMarshalMsg(z interface{}) bool

func (*MapRequiredOmitEmpty) CanUnmarshalMsg

func (_ *MapRequiredOmitEmpty) CanUnmarshalMsg(z interface{}) bool

func (*MapRequiredOmitEmpty) MarshalMsg

func (z *MapRequiredOmitEmpty) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*MapRequiredOmitEmpty) MsgIsZero

func (z *MapRequiredOmitEmpty) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*MapRequiredOmitEmpty) Msgsize

func (z *MapRequiredOmitEmpty) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MapRequiredOmitEmpty) UnmarshalMsg

func (z *MapRequiredOmitEmpty) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*MapRequiredOmitEmpty) UnmarshalMsgWithState

func (z *MapRequiredOmitEmpty) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type TotalBoundedArgs

type TotalBoundedArgs [][]byte

TotalBoundedArgs adds a maxtotalbytes directive whose bound is an expression containing spaces, to check that the whole expression survives.

func (TotalBoundedArgs) CanMarshalMsg

func (_ TotalBoundedArgs) CanMarshalMsg(z interface{}) bool

func (*TotalBoundedArgs) CanUnmarshalMsg

func (_ *TotalBoundedArgs) CanUnmarshalMsg(z interface{}) bool

func (TotalBoundedArgs) MarshalMsg

func (z TotalBoundedArgs) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (TotalBoundedArgs) MsgIsZero

func (z TotalBoundedArgs) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (TotalBoundedArgs) Msgsize

func (z TotalBoundedArgs) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*TotalBoundedArgs) UnmarshalMsg

func (z *TotalBoundedArgs) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*TotalBoundedArgs) UnmarshalMsgWithState

func (z *TotalBoundedArgs) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type TupleRequired

type TupleRequired struct {
	A string `codec:"a,required"`
	B int64  `codec:"b"`
}

TupleRequired is an array-encoded struct (see the //msgp:tuple directive) confirming the required check also runs on the tuple decode path.

func (TupleRequired) CanMarshalMsg

func (_ TupleRequired) CanMarshalMsg(z interface{}) bool

func (*TupleRequired) CanUnmarshalMsg

func (_ *TupleRequired) CanUnmarshalMsg(z interface{}) bool

func (TupleRequired) MarshalMsg

func (z TupleRequired) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (TupleRequired) MsgIsZero

func (z TupleRequired) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (TupleRequired) Msgsize

func (z TupleRequired) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*TupleRequired) UnmarshalMsg

func (z *TupleRequired) UnmarshalMsg(bts []byte) (o []byte, err error)

func (*TupleRequired) UnmarshalMsgWithState

func (z *TupleRequired) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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