Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Version = "dev" Commit = "unknown" )
Version and Commit identify the running CLI build.
Only release binaries (GoReleaser) stamp these via ldflags (-X ...versioninfo.Version=...). Every other build -- `mise build`, `go install github.com/entireio/cli/cmd/entire@<version>`, and plain `go build`/`go install ./...` -- carries no ldflags, so Load() recovers them from Go's embedded build info instead and the CLI still self-reports a real version and commit.
Functions ¶
func Load ¶ added in v0.7.0
func Load()
Load fills Version and Commit from the binary's build info when ldflags left them at their defaults. Call once from main() before either is read.
func UserAgent ¶ added in v0.7.8
func UserAgent() string
UserAgent is the HTTP User-Agent the CLI sends on outbound requests: "entire-cli/<version>". Call after Load() so the version is resolved.
func WrapTransport ¶ added in v0.10.3
func WrapTransport(next http.RoundTripper) http.RoundTripper
WrapTransport returns next wrapped so every request sent through it carries UserAgent(). A nil next means Go's default transport, matching how http.Client treats a nil Transport.
Prefer this over setting the header at a call site whenever the *http.Client is handed to a helper that builds its own requests (clusterdiscovery's well-known fetch, coreapi's token exchange): those requests never pass through the caller's code, so only the transport can stamp them.
Wrap innermost. When a client layers transports, this belongs at the base of the chain rather than on top: a transport above it may synthesize requests of its own and send them straight to its base, bypassing anything wrapped outside it. Stamping at the base catches every request that actually leaves the process.
The User-Agent is resolved per request rather than captured here, because construction can happen before the version is known: main() calls Load() to recover it from the binary's build info, and any client built during package initialization — pluginHTTPClient is one — would otherwise pin "entire-cli/dev" for the life of the process on every build without ldflags (`go install ...@<version>`). Binding late makes construction order irrelevant.
Types ¶
This section is empty.