version

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package version provides build-time version variables. Set these via -ldflags at build time:

go build -ldflags "-X github.com/hatami57/microjet/core/version.Version=1.2.3 \
    -X github.com/hatami57/microjet/core/version.CommitHash=$(git rev-parse --short HEAD) \
    -X github.com/hatami57/microjet/core/version.BuildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)"

Index

Constants

This section is empty.

Variables

View Source
var (
	Version    = "dev"
	CommitHash = "unknown"
	BuildTime  = "unknown"
)

Functions

func GoVersion

func GoVersion() string

GoVersion reports the Go toolchain that built the binary. It is authoritative at runtime, so unlike Version/CommitHash/BuildTime it is not set via ldflags.

func Print

func Print()

func String

func String() string

Types

type Info

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

Info holds all version fields as a value type for structured access or logging.

func Get

func Get() Info

Get returns the current build's version info.

func (Info) Print

func (i Info) Print(w io.Writer)

Print writes version fields as key=value lines to w.

func (Info) PrintToStdout

func (i Info) PrintToStdout()

PrintToStdout writes version fields as key=value lines to stdout.

Jump to

Keyboard shortcuts

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