version

package
v0.0.0-...-b973d07 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package version describes the build. algodtop has no release numbers: every commit on main is a release, and Go names it with a pseudo-version that holds the commit's UTC time, such as v0.0.0-20261104123549-37f0e9db466c. A build can still set a version at link time with -ldflags "-X algod.top/internal/version.Version=...".

Index

Constants

This section is empty.

Variables

View Source
var Version = "dev"

Version is the release version set at link time, or "dev".

Functions

func Age

func Age(d time.Duration) string

Age says how old a build is in its largest whole unit, such as "40 minutes old", "5 hours old" or "3 days old".

func String

func String() string

String is Info().String().

func TimeOf

func TimeOf(v string) (time.Time, bool)

TimeOf reads the commit time from a pseudo-version such as v0.0.0-20261104123549-37f0e9db466c. Upgrades compare releases by it.

Types

type Build

type Build struct {
	Version  string    // such as v0.0.0-20261104123549-37f0e9db466c, or "dev"
	Revision string    // the commit hash, when known
	Time     time.Time // the commit time in UTC, when known
	Modified bool      // built from a tree with uncommitted changes
}

Build is what the binary knows about the commit it came from.

func Info

func Info() Build

Info reads the build. A local build in a git checkout knows its commit from the VCS stamp. A build by go install knows it from the pseudo-version.

func Parse

func Parse(v string) Build

Parse reads a version string into a Build, with the commit time and hash when it is a pseudo-version.

func (Build) Describe

func (b Build) Describe(now time.Time) string

Describe names the build by its commit's time and age, such as "2026-11-04 12:35 UTC (37f0e9db), 3 days old". A version set at link time comes first. A build with no commit time, such as one from a source archive, gets String.

func (Build) String

func (b Build) String() string

String is the version with the commit when the version does not hold it, such as "dev (37f0e9db)". Its first word is the version, which remote install looks up.

func (Build) UnixNano

func (b Build) UnixNano() int64

UnixNano is the commit time in Unix ns, or 0 when it is unknown.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL