docs/pkg/buildinfo.md

pkg/buildinfo

pkg/buildinfo owns EzAgent's runtime release identity and its embedded third-party legal-notice report. To classify dependencies or regenerate that report, see cmd/genlicenses; for the CLI flag that prints it, see pkg/cli and cmd/ez-agent. For provider and webfetch user-agent behavior, see pkg/service/agent and internal/webfetch.

What is in this package?

RoleSource
Release identity and provider-facing user agentversion.go
Embedded report API and generation hooklicenses.go
Generated, committed notice artifact with version placeholderthird_party_licenses.txt
Package contractsbuildinfo_test.go

How is release identity formed?

Version in version.go is the single release-identity value; that file shows the release-build override and UserAgent(). Do not infer a release pipeline or versioning policy from this override mechanism.

The embedding and placeholder substitution live in licenses.go. Keep the generated artifact committed and retain the placeholder that ThirdPartyLicenseReport() substitutes.

Who consumes this information?

ConsumerContract
CLI--third-party-licenses prints the report before daemon or configuration work. See pkg/cli.
Service providersApplies the EzAgent user agent after configured extra headers, so configuration cannot silently replace that identity. See pkg/service/agent.
Webfetch--version uses Version; its default user agent uses UserAgent(), but explicit user-agent/header input may override or suppress it. See internal/webfetch.

For the standalone webfetch command, see cmd/ez-agent-webfetch.

What must stay true when notices change?

Do not hand-edit the artifact. From the repository root, use just licenses to refresh it and just licenses-check to verify it. The package's go generate directive invokes the generator from pkg/buildinfo, with an output path relative to that directory; do not interchange those command contexts.

Dependency discovery, classification, legal-file selection, and rendering policy belong to cmd/genlicenses, not this package. The generator and its tests enforce a current deterministic artifact, complete explicit policy, sorted components, and preserved legal-file bytes.

Where are exact rules verified?