Documentation
¶
Overview ¶
Package version holds the build metadata that identifies an uptickd binary.
It exists in this module, rather than relying on the SDK's package alone, because the JSON-RPC endpoint `web3_clientVersion` does not read the SDK's variables. That endpoint is served by the cosmos/evm `web3` namespace, which formats github.com/cosmos/evm/version.Version() -- and nothing in this repository injected anything into that package: not the Makefile, not .goreleaser.yml, not the rbuilder image. Every release node therefore answered `web3_clientVersion` with "Version dev ()\nCompiled at using Go <version>", so the version number, the commit and the build time were all missing, and two nodes built from different commits could not be told apart by a client.
The fix has two halves and both are load-bearing:
- the build injects AppVersion/GitCommit/BuildDate here (Makefile ldflags, .goreleaser.yml), and
- Sync publishes them to the cosmos/evm package, i.e. to the variables the endpoint actually renders. One injected package plus one bridge is deliberate: injecting the cosmos/evm symbols directly would spread the same three symbols over every build configuration instead.
A build that bypasses the release pipeline (`go build ./cmd/uptickd`, `go run`) is still identifiable: Go stamps the VCS revision into the binary, and fillFromBuildInfo reports it as the commit.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( AppVersion = "" GitCommit = "" BuildDate = "" )
Set by the build with -ldflags -X; see the Makefile and .goreleaser.yml. The names are part of the build contract -- renaming one silently disables its injection, because -X on an unknown symbol is not an error.
Functions ¶
func Sync ¶ added in v0.5.0
func Sync()
Sync publishes this package's build metadata to the cosmos/evm version package, which is what the JSON-RPC endpoint `web3_clientVersion` renders.
It runs from init() and is called again explicitly from the CLI entry point (cmd/uptickd/root.go): init() only executes while this package is linked, so the explicit call is what keeps the bridge from disappearing together with an import someone tidies away. Sync is idempotent, and a field is only copied when this package has a value for it, so an injection straight into the cosmos/evm variables still wins when this package is not the injected one.
func Version ¶
func Version() string
Version returns the string that identifies this binary, and it is the same string the JSON-RPC endpoint `web3_clientVersion` serves. It deliberately delegates to the cosmos/evm renderer instead of defining a second format here: two renderers would eventually disagree, and the endpoint is the surface operators actually read.
Types ¶
This section is empty.