Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HasFieldOrder ¶
type HasFieldOrder struct {
// contains filtered or unexported fields
}
HasFieldOrder is a Fact attached to structs listing the field instantiation order.
func NewHasFieldOrder ¶
func NewHasFieldOrder(ol []string) *HasFieldOrder
func (HasFieldOrder) AFact ¶
func (h HasFieldOrder) AFact()
func (HasFieldOrder) FieldOrder ¶
func (h HasFieldOrder) FieldOrder() []string
FieldOrder returns a defensive copy of the expected field order.
func (HasFieldOrder) String ¶
func (h HasFieldOrder) String() string
type StructDecl ¶
type StructDecl struct {
// contains filtered or unexported fields
}
StructDecl represents a struct declaration.
func NewStructDecl ¶
func NewStructDecl(ts *ast.TypeSpec, doc *ast.CommentGroup) (StructDecl, bool)
NewStructDecl creates a new StructDecl. It needs to have a directive: //go:structinit.
func (*StructDecl) FieldOrder ¶
func (s *StructDecl) FieldOrder() []string
type StructInit ¶
type StructInit struct {
// contains filtered or unexported fields
}
func NewStructInit ¶
func NewStructInit(cl *ast.CompositeLit) (StructInit, bool)
func (StructInit) Diagnose ¶
func (s StructInit) Diagnose(fset *token.FileSet, expectedOrder []string) *analysis.Diagnostic
Diagnose checks if the fields are initialized in the correct order. TODO: think about using pass.
Click to show internal directories.
Click to hide internal directories.