// Package buildinfo exposes the version metadata injected at link time. // // Version and Commit are set by the build scripts with // // go build -ldflags "-X github.com/yuanyuanxiang/SimpleRemoter/server/go/buildinfo.Version=... \ // -X github.com/yuanyuanxiang/SimpleRemoter/server/go/buildinfo.Commit=..." // // They stay empty when the binary is built without git (source tarball, IDE // run). Callers must report the empty string rather than inventing a value; // only the MCP initialize response substitutes a literal "dev" marker. package buildinfo var ( // Version is the full `git describe --tags --always --dirty` string, e.g. // "v1.4.2-72-g425d737-dirty". Version = "" // Commit is the short commit hash, e.g. "425d737". Commit = "" ) // Info is a JSON-friendly snapshot of the injected metadata. type Info struct { Version string `json:"version"` Commit string `json:"commit"` } // Snapshot returns the current build metadata. It is safe to call before the // values are injected (both fields are empty). func Snapshot() Info { return Info{Version: Version, Commit: Commit} }