modelcheck

package
v0.51.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 15 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

Package modelcheck checks that table-backed models are declared only through the generator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(ctx context.Context, dir string, patterns []string) ([]*generate.AnalysisPackage, error)

Load includes test sources and honours the selected module's build configuration. Loading failures are errors, never an empty successful check.

Types

type Analysis

type Analysis struct {
	Package *types.Package
	Context context.Context
	Info    *types.Info
	Files   *token.FileSet
	// contains filtered or unexported fields
}

Analysis retains one package's type information and function-alias definitions.

func NewAnalysis

func NewAnalysis(info *types.Info, files *token.FileSet) *Analysis

func (*Analysis) CheckPackage

func (a *Analysis) CheckPackage(syntax []*ast.File) []Diagnostic

CheckPackage checks all syntax files of one package for low-level table declarations.

func (*Analysis) Function

func (a *Analysis) Function(expr ast.Expr) *types.Func

Function resolves direct references, import aliases, dot imports, and function values whose assignments all select the same function.

func (*Analysis) Index

func (a *Analysis) Index(file *ast.File)

type Diagnostic

type Diagnostic struct {
	Position token.Position `json:"position"`
	Target   string         `json:"target"`
	Message  string         `json:"message"`
}

Diagnostic names the source location, model or type, and the replacement action.

func Check

func Check(ctx context.Context, dir string, patterns []string) (result []Diagnostic, resultErr error)

Check inspects packages below dir matching patterns for low-level table declarations.

func (Diagnostic) String

func (d Diagnostic) String() string

Jump to

Keyboard shortcuts

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