buildinfo

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package buildinfo exposes this binary's build identity to library code.

The version string has always been an ldflags-injected variable in package main (cmd/sidecar/main.go), which means nothing under internal/ could read it. That was fine while only `--version` cared. It stops being fine the moment a remote host has to answer "what sidecar am I talking to?" over a wire — the host protocol's hello carries a version string, and the code that builds the hello is a library.

Set is called once from main before any command dispatch. Everything else reads Version, which falls back to debug.ReadBuildInfo so a plain `go build` and `go test` still report something truthful rather than an empty string.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Set

func Set(version string)

Set records the ldflags-injected version. Calling it with the empty string is a no-op, so main can pass its variable through unconditionally and let the build-info fallback answer for an un-stamped build.

func Version

func Version() string

Version returns the release version when the build was stamped, and otherwise derives a development version from the embedded VCS data. The derivation is the one `sidecar --version` has always printed; it lives here now so both main and the host protocol read the same answer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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