version

Reference for linuxguard-agent --version and the build-time metadata (version string, git commit, build timestamp) the agent reports.

Synopsis

Print the agent's build-time version string, git commit hash, and build timestamp, then exit. Used for support-ticket attachments, CI artefact identification, and runtime drift detection ("is the binary on disk the version I expect?"). The version surface is implemented by urfave/cli/v2's built-in --version and -v flags — there is no linuxguard-agent version subcommand; the version is a top-level flag on the binary.

linuxguard-agent --version

Note: support-bundle collect embeds the same version string in BUNDLE-MANIFEST.json and system.json (via supportbundle.SetAgentVersion(version) called from main). When triaging a bundle, prefer the manifest's agent_version over running --version on a current binary — the binary may have been upgraded between the bundle collection time and the triage time.

How the version string is composed

The string printed by --version is composed from three ldflags-injected build-time variables:

<version> (commit: <git_commit>, built: <build_time>)
Component
Source
Set by

<version>

semantic version tag (e.g., v3.0.0) or dev for local builds

-ldflags="-X main.version=..." at build time

<git_commit>

short or full git commit SHA the build was produced from

-ldflags="-X main.gitCommit=..." at build time

<build_time>

UTC RFC3339 timestamp of the build

-ldflags="-X main.buildTime=..." at build time

The string is assembled at startup via fmt.Sprintf("%s (commit: %s, built: %s)", version, gitCommit, buildTime). Local go build invocations that omit the ldflags produce dev (commit: , built: ) — useful for distinguishing a developer build from a packaged release on disk.

Flags

--version (and its short form -v) is the only flag in scope. urfave/cli/v2 provides both forms by default:

Flag
Description

--version

Print the version string and exit 0.

-v

Short alias for --version.

--help, -h

Print the top-level help including the agent's command catalogue.

Environment

--version reads no environment variables. The version string is fully baked into the binary at build time.

Signals

--version is a one-shot CLI invocation — it does not install signal handlers via signal.Notify. The command returns immediately after printing the string.

Exit codes

Code
Meaning

0

Always. The version string was printed to stdout. urfave/cli/v2's built-in --version cannot fail at runtime — the string is a compile-time constant assembled in main.

Examples

Inspect a packaged release

Stdout:

The leading LinuxGuard Agent version is urfave/cli/v2's default prefix; the rest is the agent-supplied string. Stable channel packages include a non-empty git commit and build timestamp.

Inspect a developer build

Stdout:

The empty commit and built fields identify the binary as a local build that did not pass through the release ldflags. Treat such binaries as test artefacts; do NOT deploy them to production hosts.

Capture the version for a support ticket

Attach both files to the support ticket. The bundle's BUNDLE-MANIFEST.json and system.json already embed the version, but the standalone --version output captures the exact build of the binary running at ticket-open time (the bundle may be older).

Distinguish two binaries on disk

Useful when an unpackaged build was dropped alongside the system-managed package — the version string identifies which binary is which without inspecting file timestamps.


Related: start | show-config | support-bundle | CLI Reference

Last updated

Was this helpful?