version

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package version formats a CLI version banner.

Each binary's main package declares its own ldflag-populated `version`, `commit`, `date` variables and passes them to Print. When the binary is built without ldflags (e.g. `go install`), missing fields are filled from runtime/debug.ReadBuildInfo where possible.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Print

func Print(w io.Writer, name, version, commit, date string)

Print writes a single-line version banner of the form

<name> <version> (<commit>, built <date>)

Empty / placeholder fields are filled from runtime/debug.ReadBuildInfo when available so that `go install ...@latest` builds also produce a useful banner.

func Resolve

func Resolve(version, commit, date string) (resolvedVersion, resolvedCommit, resolvedDate string)

Resolve returns the version triple, falling back to VCS info from the embedded build info when the input fields are placeholders or empty. Exported for testing.

Types

This section is empty.

Jump to

Keyboard shortcuts

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