version

package
v0.1.35 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package version exposes build metadata injected via -ldflags -X at build time.

Index

Constants

This section is empty.

Variables

View Source
var (
	Version   = "dev"
	Commit    = "none"
	BuildTime = "unknown"
)

These are overridden at build time:

go build -ldflags "-X github.com/Benny93/kafui/pkg/version.Version=v1.2.3 ..."

Functions

func IsOutdated

func IsOutdated(current, latestTag string) bool

IsOutdated reports whether the running Version is older than latestTag. Comparison is a lenient semver-ish compare after stripping a leading "v"; non-release builds ("dev", empty) are never considered outdated.

func ShortCommit

func ShortCommit() string

ShortCommit returns the commit truncated to 7 characters.

Types

type Info

type Info struct {
	Version   string
	Commit    string
	BuildTime string
	GoVersion string
	Platform  string
	Features  []string
}

Info is the resolved build metadata plus the runtime environment.

func Get

func Get(features ...string) Info

Get returns the current build info. features lists enabled feature flags (e.g. "dynamic-config", "mock") supplied by the caller.

func (Info) String

func (i Info) String() string

String renders a one-line summary.

type Release

type Release struct {
	TagName string `json:"tag_name"`
	HTMLURL string `json:"html_url"`
}

Release is the subset of the GitHub release payload we care about.

func CheckLatest

func CheckLatest(ctx context.Context, timeout time.Duration) (*Release, error)

CheckLatest queries the GitHub releases API for the newest published release. All failures are swallowed into a nil result + error; callers treat any error as "unknown, don't nag". Honors ctx and the given timeout.

Jump to

Keyboard shortcuts

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