version

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: AGPL-3.0 Imports: 3 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(w io.Writer) error

WriteJSON marshals the version info as indented JSON to w.

func WriteJSONToStdout

func WriteJSONToStdout() error

WriteJSONToStdout marshals the version info as indented JSON to os.Stdout, for CLI use.

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