analyzer

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2025 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAnalyzer

func NewAnalyzer(config Config) (*analysis.Analyzer, error)

Types

type Config

type Config struct {
	// IncludeRx is a list of regular expressions to match type names that should be
	// processed. Anonymous structs can be matched by '<anonymous>' alias.
	//
	// Each regular expression must match the full type name, including package path.
	// For example, to match type `net/http.Cookie` regular expression should be
	// `.*/http\.Cookie`, but not `http\.Cookie`.
	IncludeRx []string `exhaustruct:"optional"`

	// ExcludeRx is a list of regular expressions to match type names that should be
	// excluded from processing. Anonymous structs can be matched by '<anonymous>'
	// alias.
	//
	// Has precedence over IncludeRx.
	//
	// Each regular expression must match the full type name, including package path.
	// For example, to match type `net/http.Cookie` regular expression should be
	// `.*/http\.Cookie`, but not `http\.Cookie`.
	ExcludeRx []string `exhaustruct:"optional"`

	// AllowEmpty allows empty structures, effectively excluding them from the check.
	AllowEmpty bool `exhaustruct:"optional"`

	// AllowEmptyRx is a list of regular expressions to match type names that should
	// be allowed to be empty. Anonymous structs can be matched by '<anonymous>'
	// alias.
	//
	// Each regular expression must match the full type name, including package path.
	// For example, to match type `net/http.Cookie` regular expression should be
	// `.*/http\.Cookie`, but not `http\.Cookie`.
	AllowEmptyRx []string `exhaustruct:"optional"`

	// AllowEmptyReturns allows empty structures in return statements.
	AllowEmptyReturns bool `exhaustruct:"optional"`

	// AllowEmptyDeclarations allows empty structures in variable declarations.
	AllowEmptyDeclarations bool `exhaustruct:"optional"`
	// contains filtered or unexported fields
}

func (*Config) BindToFlagSet

func (c *Config) BindToFlagSet(fs *flag.FlagSet) *flag.FlagSet

BindToFlagSet binds the config fields to the provided flag set.

func (*Config) Prepare

func (c *Config) Prepare() error

Prepare compiles all regular expression patterns into pattern lists for efficient matching.

type TypeInfo

type TypeInfo struct {
	Name        string
	PackageName string
	PackagePath string
}

func (TypeInfo) ShortString

func (t TypeInfo) ShortString() string

func (TypeInfo) String

func (t TypeInfo) String() string

Jump to

Keyboard shortcuts

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