layout

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decl

type Decl struct {
	// contains filtered or unexported fields
}

Decl is what one package directory declares, and where — the anchor for any diagnostic about it.

func (Decl) Line

func (d Decl) Line() int

Line is the line that declaration sits on.

func (Decl) Path

func (d Decl) Path() SourcePath

Path is the file that anchors a diagnostic about this package.

type Key

type Key struct {
	// contains filtered or unexported fields
}

Key identifies one corresponding command/domain pair: the tree prefix holding the internal/ directory, and the verb path beneath the marker — kept separate so parallel internal trees stay distinct and either tier's directory can be spelled back for a diagnostic.

func (Key) CommandDir

func (k Key) CommandDir() TierDir

CommandDir and DomainDir spell the key's directory in each tier.

func (Key) DomainDir

func (k Key) DomainDir() TierDir

func (Key) Nests

func (k Key) Nests(other Key) bool

Nests reports whether other lies beneath k in the SAME internal tree — the shape of a parent package that only mounts subcommands.

type Program

type Program struct {
	// contains filtered or unexported fields
}

Program is one main package that BUILDS a urfave command — a command tree, as opposed to a main that hands a declaration to a framework driver.

func (Program) Dir

func (p Program) Dir() string

Dir is the program's package directory.

func (Program) Path

func (p Program) Path() SourcePath

Path is the file that anchors a diagnostic about this program.

type Published added in v0.13.0

type Published struct {
	// contains filtered or unexported fields
}

Published is one importable package a repository exposes: a directory of non-test Go files whose package is not main, which lies outside internal/, and which actually declares something.

func (Published) Describe added in v0.13.0

func (p Published) Describe() string

Describe names the package as a diagnostic's subject, RELATIVE to the repository.

The absolute path is already carried by Path, where a tool needs it to open the file; repeating it in the prose names a location true only on the machine that ran the check.

The package at the repository root has no directory to name — its relative path is "." — so naming it positionally says nothing about what to move. Naming it as what it is does.

func (Published) Path added in v0.13.0

func (p Published) Path() SourcePath

Path is the file that anchors a diagnostic about this package.

type SourcePath

type SourcePath string

SourcePath is the path of one Go source file under the walked root.

type TierDir

type TierDir string

TierDir is one tier's directory for a pair, spelled for a diagnostic.

type Tree

type Tree struct {
	// contains filtered or unexported fields
}

Tree is every self-declaring package of each tier, by pair key.

func Collect

func Collect(dir suite.Dir) (Tree, error)

Collect walks the module once, parsing every non-test Go file beneath a tier marker and recording the packages that declare themselves.

func (Tree) BuildsProgram added in v0.13.0

func (t Tree) BuildsProgram() bool

BuildsProgram reports whether the repository builds a program under cmd/.

It is deliberately NOT limited to programs built from a particular framework. Whether a repository is a command is decided by its shipping one, whoever wrote the driver — and keying on the framework is precisely what let the analyzer repositories through, since their mains hand one analyzer to go/analysis's singlechecker and construct no command tree at all. That exemption is right for the tier rule, which asks whether a command tree is SPLIT correctly and has nothing to say about a program with no verbs. It is wrong here, because publishing a package is not a question about verbs.

func (Tree) Commands

func (t Tree) Commands() map[Key]Decl

Commands is every self-declaring command package found, by pair key.

func (Tree) Domains

func (t Tree) Domains() map[Key]Decl

Domains is every self-declaring domain verb found, by pair key.

func (Tree) Programs

func (t Tree) Programs() []Program

Programs is every command-building main package found, anchored at its first such file and ordered by directory so a report is deterministic.

One program, one entry: a tree split across several files of one main package is still one program, and counting files would make a four-file main look four times as significant as a one-file one.

func (Tree) PublishedPackages added in v0.13.0

func (t Tree) PublishedPackages() []Published

PublishedPackages is every importable package the repository exposes, ordered by directory so a report is deterministic.

Jump to

Keyboard shortcuts

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