lint

package
v1.232.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lint

type Lint mg.Namespace

Lint groups repository lint and formatting targets.

func (Lint) Changed

func (Lint) Changed() error

Changed runs go.mod validation, ensures custom-gcl is built (only if stale), then runs the patch-scoped golangci-lint pass against changes from origin/main. Equivalent to the previous `atmos lint changed` chain (gomodcheck -> custom-gcl -> run-custom-golangci-lint.sh).

No dedicated test: this is a one-line composition with no branching logic of its own. Every target it calls (GoModCheck, CustomGCL, Precommit) is unit-tested independently; meaningfully testing Changed itself would mean re-running CustomGCL's real `golangci-lint custom` network fetch + full recompile, which is integration-test territory this package exists to make lazy/cached, not something worth re-running in the unit-test tier.

func (Lint) CustomGCL

func (Lint) CustomGCL() error

CustomGCL builds the custom golangci-lint binary (with the lintroller plugin compiled in) via `golangci-lint custom`, but only when the existing binary is missing or older than its build inputs (.custom-gcl.yml or any tools/lintroller source/module file). Rebuilding unconditionally is the single biggest waste in `lint changed` (golangci-lint custom clones and recompiles a full binary), so this mirrors the previous bash staleness guard exactly.

func (Lint) GoModCheck

func (Lint) GoModCheck() error

GoModCheck verifies go.mod has no replace/exclude directives that would break `go install` for consumers of this module. It runs via `go run` rather than a staleness-cached binary — Go's build cache already makes repeat compiles fast, so the hand-rolled cached-binary staleness check the atmos-command version previously had (mirroring tools/lintroller's) bought little for the extra code, and this now gives the pre-commit hook and `atmos lint gomodcheck` byte-identical behavior for the first time.

func (Lint) Lintroller

func (Lint) Lintroller() error

Lintroller builds (if stale) and runs the standalone Atmos lintroller analyzer binary against every non-testdata package.

func (Lint) Precommit

func (Lint) Precommit() error

Precommit runs golangci-lint (with lintroller) against changed files using the pre-built ./custom-gcl binary.

IMPORTANT: this target must never build ./custom-gcl itself. Building `golangci-lint custom` (a full clone + recompile of golangci-lint) inside a pre-commit hook previously corrupted git worktrees; the fix is that the hook only ever checks for a pre-built binary and fails fast with a helpful message if it's missing. Do not "helpfully" wire CustomGCL in as a dependency here.

Jump to

Keyboard shortcuts

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