Documentation
¶
Overview ¶
Package cliversion provides a go/analysis analyzer enforcing the gomatic CLI standard that a urfave/cli `package main` exposes --version: a urfave command literal sets its Version field to the package-level `var version` (the ldflags `-X main.version` target). It verifies the GO side only — the goreleaser ldflag↔symbol match is a separate stickler-level YAML check.
Scope is the `cmd/<app>/main.go` package. The rule is a package-level invariant — "main builds a urfave command whose Version is `var version`" — so extra command literals (e.g. an inline subcommand, which legitimately has no Version) never produce a false positive; only the absence of ANY properly version-wired command is reported. Wiring is recognized in a keyed literal field, a positional literal element, or a post-construction assignment (`cmd.Version = version`), and through type aliases of the command types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Analyzer = &analysis.Analyzer{ Name: "cliversion", Doc: "reports a urfave/cli main package that does not wire a command Version to `var version`", Requires: []*analysis.Analyzer{inspect.Analyzer}, Run: run, }
Analyzer reports a urfave/cli main package that does not wire a command's Version to the package-level `var version`.
var Registration = goyze.Registration{ Name: "cliversion", Categories: []goyze.Category{"cli"}, URL: "https://docs.gomatic.dev/yze/cliversion", Analyzer: Analyzer, }
Registration declares this analyzer to the yze framework.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
yze-go-cliversion
command
Command yze-go-cliversion runs the cliversion analyzer as a standalone go/analysis checker (text and -json output, and usable as a `go vet -vettool`).
|
Command yze-go-cliversion runs the cliversion analyzer as a standalone go/analysis checker (text and -json output, and usable as a `go vet -vettool`). |