cliv3

package module
v0.2.34 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 8 Imported by: ? 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.

README

Documentation

Overview

Package cliv3 provides a go/analysis analyzer enforcing the gomatic CLI standard that Go programs use urfave/cli v3 — never the legacy v1 or v2.

Five import path roots are KNOWN to serve legacy urfave/cli code. Each is reported as the module root itself and as every package beneath it, because a subpackage of a legacy module is legacy code and drags the legacy module into the build. Beneath every root, a first segment that is a Go major-version directory ("v2", "v3", …) is excluded, because those directories hold a different major that is judged on its own:

  • "github.com/urfave/cli" — v1. That version-directory exclusion is the whole of the exemption: any other package beneath v1 — "github.com/urfave/cli/altsrc" is the one that exists in v1.22.17 — is v1 code and is reported.
  • "github.com/urfave/cli/v2" — v2.
  • "github.com/codegangsta/cli" — the name urfave/cli was renamed FROM, still served by GitHub with 51 published versions. At v1.20.0 its tree is byte-identical to github.com/urfave/cli@v1.20.0 and it resolves, builds and links today.
  • "gopkg.in/urfave/cli.v1" and "gopkg.in/codegangsta/cli.v1" — the same v1 code under gopkg.in, both resolving at v1.20.0 with the identical tree.

The comparison of a path against a root is CASE-INSENSITIVE. Import paths are case-sensitive to the Go toolchain, but the hosts here are not: at any version published before go.mod existed there is no declared module path to disagree with, so "github.com/Urfave/cli@v1.20.0" resolves, builds and hands back the same *cli.App. Case is an unbounded family of spellings and folding it closes all of them at once. From v1.22.x onward the module's own go.mod rejects every variant spelling, which is why only the pre-module versions are reachable.

THE ENUMERATION IS NOT CLOSED, AND THIS COMMENT DOES NOT CLAIM IT IS. "No path spelling escapes" is a negative universal over an unbounded set of host aliases, vanity domains, forks and local `replace` directives, and no finite list of roots closes it — the codegangsta family above was found by somebody remembering a rename, not by any instrument here. What is claimed is the bound: these five roots, folded for case, cover every spelling MEASURED to resolve against proxy.golang.org and hand back urfave/cli v1 or v2. What would actually close it is a decision made on something the import path cannot forge — the identity of the package the import resolves TO, which go/analysis offers as the resolved package object. That is the shape the rule should eventually take.

The diagnostic names the package that REPLACES the one it reports, because a diagnostic naming a destination the author cannot reach leaves silencing the rule as the only move. A module root is replaced by "github.com/urfave/cli/v3"; a subpackage is replaced by the module urfave extracted it into at the v3 major, "github.com/urfave/cli-<name>/v3". urfave/cli/v3 carries no IMPORTABLE subpackage — the directories under v3.10.1 that hold Go files are all `package main` examples and scripts — and cli-altsrc/v3 and cli-docs/v3 are both published.

The rule is about the import path a file names, so it holds in test files as much as in production files: a _test.go that builds a v2 App makes the module depend on v2 either way. This analyzer is therefore deliberately absent from the yze suite's source-only scope, unlike the four sibling CLI rules (cliapp, clidomain, cliflags, cliversion), which judge how the PRODUCTION program is wired and have a legitimate test-side idiom. There is no test idiom that needs v2. That absence is a fact about ANOTHER repository — gomatic/yze's registrations.go — which this package cannot see and no test here can pin; if cliv3 is ever added to that set, every _test.go finding this rule makes goes silent and nothing in this repo goes red.

The analyzer registers no flags and offers no suggested fix.

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:     "cliv3",
	Doc:      "reports imports of the legacy urfave/cli v1/v2, which the gomatic CLI standard forbids in favor of v3",
	Requires: []*analysis.Analyzer{inspect.Analyzer},
	Run:      run,
}

Analyzer reports imports of the legacy urfave/cli v1/v2 packages.

View Source
var Registration = goyze.Registration{
	Precision:  goyze.PrecisionExact,
	Name:       "cliv3",
	Categories: []goyze.Category{"cli"},
	URL:        "https://docs.gomatic.dev/yze/cliv3",
	Analyzer:   Analyzer,
}

Registration declares this analyzer to the yze framework.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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