cliversion

package module
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 6 Imported by: 0

README

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

View Source
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`.

View Source
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`).

Jump to

Keyboard shortcuts

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