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 ¶
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.
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.