Help us shape the future of Go! Take the 2026 Go Developer Survey

version

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "Show version/build information"

Name is the command title.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand(_ *config.Config, _ *flags.Options) *cli.Command

NewCommand creates a new version command.

The configuration and the global options are what every command constructor takes, so one signature covers all of them. This command reads neither.

func Run

func Run(info Info) error

Run will print version information for the build.

Types

type Info

type Info struct {
	Version    string
	Commit     string
	CommitTime string
	Branch     string
}

Info contains injected build environment information.

var Build Info

Build is what the linker wrote into the binary, set by main before any command is built.

It is a package variable rather than a constructor argument because every command constructor takes the same two arguments, and build information is neither configuration nor a flag: it describes the binary rather than the tree it is pointed at or the run an operator asked for.

Jump to

Keyboard shortcuts

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