archlint

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 9 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 archlint owns the tree walk shared by the architecture-lint gate tests. Seven gates used to carry private copies of the same WalkDir loop, and the copies drifted: six skipped {".git", "vendor", "node_modules", "dist", "testdata", "scratch", ".claude"} while the store gate skipped every dot-prefixed directory plus "examples" and kept scanning testdata. This package is the union of those lists, as one table:

skip (directory name)   why
----------------------------------------------------------------------------
any "."-prefixed name   .git, .claude (agent worktrees), e2e/.tmp
vendor, node_modules    dependency trees
dist                    build output
testdata                per-package fixtures
scratch                 gitignored working notes
examples                shipped fixtures (demo.db and friends), never code
"test-results" prefix   Playwright artifacts, wiped and recreated by
                        parallel e2e runs — racing a wipe is the GDK-1486
                        flake; no .go file ever lives there anyway

Rules stay in their own packages, next to the code they lock; this package owns only the walk, the skip list, slash-relative paths, parsing, and the in-process parse cache. The cache lives inside one test binary: `go test ./...` runs each package as its own process, so only gate pairs inside one package (internal/origin, internal/sync) share it — there is no cross-package caching.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Walk

func Walk(root string, visit func(f *File) error) error

Walk visits every .go file under root that survives the shared skip list, in filepath.WalkDir order (lexical within each directory). Production and test files are both delivered; each rule filters by suffix and prefix itself. Rel is slash-separated on every platform. An error returned by visit aborts the walk and is returned unchanged, as are walk errors — except ENOENT: a directory another process removed mid-walk (a parallel Playwright run wiping test-results/, GDK-1486) skips quietly instead of failing the whole gate over a path that never held source.

Types

type File

type File struct {
	Path string // filesystem path as walked (joined onto Walk's root)
	Rel  string // slash-separated path relative to Walk's root
}

File is one .go file discovered by Walk. AST and Src are lazy, so a rule that filters files out by suffix or prefix never pays for what it skips.

func (*File) AST

func (f *File) AST() (*ast.File, *token.FileSet, error)

AST parses the file (parser mode 0) or returns the cached parse from an earlier Walk in the same process. Build-constrained files (//go:build ignore) are delivered and parsed like any other file: the gates are source scanners, not build participants.

func (*File) Src

func (f *File) Src() ([]byte, error)

Src reads the raw file bytes, for rules that match on text instead of the syntax tree.

Jump to

Keyboard shortcuts

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