version

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

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