version

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package version provides build-time version information for the operator. These variables are set via ldflags during the build process.

Usage:

fmt.Printf("Version: %s, Commit: %s\n", version.Version, version.GitCommit)

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version is the semantic version of the operator (e.g., "1.0.0").
	Version = "dev"

	// GitCommit is the short SHA of the git commit used to build the binary.
	GitCommit = "unknown"

	// BuildDate is the ISO 8601 date when the binary was built.
	BuildDate = "unknown"
)

These variables are set at build time via -ldflags.

Functions

This section is empty.

Types

type Info

type Info struct {
	Version   string `json:"version"`
	GitCommit string `json:"gitCommit"`
	BuildDate string `json:"buildDate"`
	GoVersion string `json:"goVersion"`
	Platform  string `json:"platform"`
}

Info holds structured version information for the operator.

func Get

func Get() Info

Get returns the current version information.

Usage:

info := version.Get()
log.Info("starting operator", "version", info.Version, "commit", info.GitCommit)

func (Info) String

func (i Info) String() string

String returns a human-readable version string.

Usage:

fmt.Println(version.Get().String())
// Output: nginx-operator dev (commit: unknown, built: unknown, go: go1.24.0, platform: linux/amd64)

Jump to

Keyboard shortcuts

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