Skip to main content

CLI Reference

Complete reference for the nopher command-line interface.

Commands

nopher generate

Generate a lockfile from go.mod and go.sum.

nopher generate [options] [directory]

Options:

OptionDescription
-tidyRun go mod tidy before generating (requires Go in PATH)
-vEnable verbose output

Examples:

# Generate lockfile in current directory
nopher generate

# Generate with verbose output
nopher generate -v

# Run go mod tidy first
nopher generate -tidy

# Generate for a specific directory
nopher generate ./path/to/project

nopher verify

Verify that the lockfile matches go.mod and go.sum.

nopher verify [directory]

Exit codes:

CodeMeaning
0Lockfile is up to date
1Lockfile needs regeneration or error occurred

Examples:

# Verify in current directory
nopher verify

# Verify specific project
nopher verify ./path/to/project

# Use in CI
nopher verify || echo "Lockfile out of date!"

nopher update

Update a specific module in the lockfile.

nopher update <module-path> [directory]

Arguments:

ArgumentDescription
module-pathThe Go module path to update (e.g., github.com/sirupsen/logrus)
directoryOptional: project directory (default: current directory)

Examples:

# Update a specific module
nopher update github.com/sirupsen/logrus

# Update module in specific project
nopher update golang.org/x/sys ./path/to/project

nopher version

Print version information.

nopher version

nopher help

Show help message.

nopher help

Environment Variables

Nopher respects standard Go environment variables:

VariableDescription
GOPROXYGo module proxy URL (default: https://proxy.golang.org)
GOPRIVATEComma-separated list of private module prefixes
GONOPROXYModules to fetch directly (bypassing proxy)

Example:

# Use a different proxy
GOPROXY=https://goproxy.io nopher generate

# Mark modules as private
GOPRIVATE=github.com/myorg/* nopher generate

Authentication

For private repositories, nopher reads credentials from ~/.netrc:

machine github.com
login oauth2
password ghp_YOUR_TOKEN_HERE

machine gitlab.com
login oauth2
password glpat-YOUR_TOKEN_HERE

See Private Repositories for detailed setup instructions.

Exit Codes

CodeMeaning
0Success
1Error (parse error, network error, etc.)

Output Files

nopher.lock.yaml

The primary output file containing all module information:

schema: 1
go: "1.22"
modules:
github.com/example/module:
version: v1.0.0
hash: sha256-...=
replace:
github.com/old/module:
new: github.com/new/module
version: v2.0.0
hash: sha256-...=