buildinfo

package
v0.0.6 Latest Latest
Warning

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

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

Documentation

Overview

Package buildinfo provides build metadata and size analysis utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LDFlags

func LDFlags(ver, sha, date, flv string) string

LDFlags returns the recommended ldflags for a production build. Values are validated and empty/unsafe inputs are replaced with defaults.

func TotalEstimate

func TotalEstimate(components []SizeEstimate) float64

TotalEstimate returns the approximate total binary size in MB.

Types

type DepInfo

type DepInfo struct {
	Path    string `json:"path"`
	Version string `json:"version"`
	Sum     string `json:"sum,omitempty"`
}

DepInfo holds dependency analysis data.

func Dependencies

func Dependencies() []DepInfo

Dependencies returns the list of compiled-in Go module dependencies. Returns an empty slice (never nil) when build info is unavailable.

type Flavor

type Flavor string

Flavor represents an initramfs build flavor.

const (
	// FlavorFull includes FRR, tools, and all features (~80 MB).
	FlavorFull Flavor = "full"
	// FlavorGoBGP uses GoBGP instead of FRR (~40 MB).
	FlavorGoBGP Flavor = "gobgp"
	// FlavorSlim is DHCP-only with minimal tools (~15 MB).
	FlavorSlim Flavor = "slim"
	// FlavorMicro is pure Go with no external tools (~10 MB).
	FlavorMicro Flavor = "micro"
)

type Info

type Info struct {
	Version   string `json:"version"`
	Commit    string `json:"commit"`
	BuildDate string `json:"buildDate"`
	GoVersion string `json:"goVersion"`
	OS        string `json:"os"`
	Arch      string `json:"arch"`
	Flavor    Flavor `json:"flavor"`
}

Info holds build-time metadata.

func Get

func Get() *Info

Get returns the current build info.

func (*Info) JSON

func (i *Info) JSON() ([]byte, error)

JSON returns the build info as JSON bytes.

type SizeEstimate

type SizeEstimate struct {
	Component string  `json:"component"`
	SizeMB    float64 `json:"sizeMB"`
	Required  bool    `json:"required"`
	BuildTag  string  `json:"buildTag,omitempty"`
}

SizeEstimate provides approximate binary size estimates per component.

func EstimateComponents

func EstimateComponents() []SizeEstimate

EstimateComponents returns known size estimates for major dependencies.

Jump to

Keyboard shortcuts

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