buildinfo

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package buildinfo reports the version, commit and build time of the running binary, from Go build information or a version set at link time.

Set an explicit version when building:

go build -ldflags "-X gorbital.dev/buildinfo.version=v1.2.3" ./cmd/api

Stability: stable (ADR-0015, ADR-0054).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler() http.Handler

Handler serves Read as JSON.

Types

type Info

type Info struct {
	Version   string `json:"version" example:"v1.2.3"`
	Commit    string `json:"commit,omitempty" example:"3f9a1c2b7d4e"`
	BuildTime string `json:"build_time,omitempty" example:"2026-09-14T12:00:00Z"`
	Modified  bool   `json:"modified,omitempty"`
	GoVersion string `json:"go_version" example:"go1.25.3"`
}

Info describes the running binary.

func Read

func Read() Info

Read returns information about the running binary. Version is "dev" when neither a link-time version nor a module version is available.

Jump to

Keyboard shortcuts

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