Documentation
¶
Overview ¶
Package layout puts every element of a composite literal, every field of a struct type and every statement of a function literal on its own line.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Equivalent ¶
Equivalent reports how out differs from src beyond layout.
Types ¶
type Correspondence ¶
type Correspondence struct {
// contains filtered or unexported fields
}
Correspondence maps code in a source file to the same code in a layout-only rewrite of it.
func NewCorrespondence ¶
func NewCorrespondence(src, out []byte) (Correspondence, error)
NewCorrespondence pairs the tokens of src with those of out, which must be src with only its layout changed.
type Kind ¶
type Kind string
Kind is a construct the rules unfold.
const ( CompositeLiteral Kind = "composite literal" StructType Kind = "struct type" FunctionLiteral Kind = "function literal" )
The constructs the rules unfold.
func (Kind) ElementName ¶
ElementName is what a construct of this kind holds, one per line.
type Rules ¶
Rules says which constructs are unfolded: MinElements counts elements, fields or statements.
func DefaultRules ¶
func DefaultRules() Rules
DefaultRules unfolds every non-empty composite literal, struct type and function literal.