version

package
v4.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: AGPL-3.0 Imports: 2 Imported by: 2 modules, 2 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.

Documentation

Overview

Package version manages build-time version and VCS metadata injection via linker flags.

Index

Constants

This section is empty.

Variables

View Source
var (
	Version    string // e.g. semver from release tag (v1.2.3)
	CommitHash string
	CommitTime string
	BuildTime  string
)

Build-injected variables (set via -ldflags -X at build time).

Functions

func WriteJSON

func WriteJSON() error

WriteJSON marshals the version info as indented JSON to os.Stdout.

Types

type Info

type Info struct {
	Version    string `json:"version"`
	CommitHash string `json:"commit_hash"`
	CommitTime string `json:"commit_time"`
	BuildTime  string `json:"build_time"`
}

Info holds VCS and build metadata for JSON output.

func Get

func Get() Info

Get returns the current version info, using "unknown" for any unset field.

Jump to

Keyboard shortcuts

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