version

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package version provides build-time version information. Values are injected via -ldflags at build time:

go build -ldflags "-X github.com/ANIAN0/filebrowser-cli/pkg/version.Version=v1.0.0 \
                  -X github.com/ANIAN0/filebrowser-cli/pkg/version.Commit=$(git rev-parse HEAD) \
                  -X github.com/ANIAN0/filebrowser-cli/pkg/version.BuildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)"

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version is the semantic version string (e.g., "v1.0.0").
	// Default is "dev" for development builds.
	Version = "dev"

	// Commit is the git commit hash.
	// Default is "unknown" for development builds.
	Commit = "unknown"

	// BuildTime is the UTC build timestamp in RFC 3339 format.
	// Default is empty for development builds.
	BuildTime = ""
)

These variables are set at build time via -ldflags.

Functions

func String

func String() string

String returns a formatted version string for --version output. Format: "v1.0.0 (abc123, built 2024-01-01T00:00:00Z)"

Types

type Info

type Info struct {
	Version   string
	Commit    string
	BuildTime string
}

Info returns a struct with version information.

func Get

func Get() Info

Get returns the version information as a struct.

Jump to

Keyboard shortcuts

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