Documentation
¶
Overview ¶
Package buildinfo pkg/buildinfo/buildinfo.go c0-com-util
The encoding/json-using init() that parses ldflags-injected `go list -m -json` output lives in buildinfo_native.go (!js). Under js/wasm, ldflags injection is not the typical path — the install-page WASM is rebuilt against the latest skywire dependency, not with custom -X overrides — so the json parse is effectively dead code there. Build-tag-gating it lets TinyGo strip encoding/json's reflect runtime helpers from the WASM bundle.
Package buildinfo pkg/buildinfo/buildinfo_native.go c0-com-util
Native init() that parses the ldflags-injected `go list -m -json` output via encoding/json. Build-tag-gated off the WASM path — see buildinfo.go's package doc for the rationale.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildTags ¶
func BuildTags() string
BuildTags returns the build tags recorded by the Go toolchain (the "-tags" build setting), or "" if none / unavailable.
func DebugBuildInfo ¶
DebugBuildInfo returns the raw debug.BuildInfo struct.
func DepVersion ¶
DepVersion returns the version of a specific dependency module. modulePath should be something like "github.com/skycoin/skycoin"
func VersionOrCommit ¶
func VersionOrCommit() string
VersionOrCommit returns Version() when a real (non-devel) version is known, otherwise a "dev-<short-commit>[-dirty]" string derived from the VCS info the Go/TinyGo toolchain records automatically (vcs.revision / vcs.modified). It lets a build that injects no version via ldflags — the wasm-visor, whose blob is compiled at an earlier commit than the binary that embeds it and so cannot borrow the host's version — still self-describe the commit it was built from instead of reporting "unknown". Returns unknown only when neither a version nor a commit is recorded.
Types ¶
type Info ¶
type Info struct {
Go string `json:"go,omitempty"`
Version string `json:"version"`
Commit string `json:"commit"`
Date string `json:"date"`
OS string `json:"os"`
Arch string `json:"arch"`
BuildTags string `json:"build_tags,omitempty"`
}
Info represents build metadata.
type ModuleInfo ¶
type ModuleInfo struct {
Version string `json:"Version"`
Origin struct {
Hash string `json:"Hash"`
} `json:"Origin"`
}
ModuleInfo represents the JSON structure returned by `go list -m -json`.