version

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 3 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 exposes the semantic version of the installed grat binary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(left string, right string) int

Compare orders two grat versions the way semantic versioning does.

It returns a negative number where left names the older release, zero where both name the same one, and a positive number where left is the newer. Either may carry the v prefix or leave it out.

Anything that is not a semantic version orders below one that is, so a tag nobody can read never counts as newer than what is installed. That is the point of this function: grat replaces its own binary from whatever GitHub marks as the latest release, and comparing the two for equality alone installs an older one as readily as a newer one. Proving where a binary came from says nothing about its age.

func Current

func Current() string

Current returns the version of the running grat for user-facing output.

A release build names its version through the linker. Without that, the Go build information carries the module version: the tag for go install with a version, and a pseudo-version for a build from a checkout, which the go command derives from version control. Either may omit the v prefix, which is added here.

func Valid

func Valid(value string) bool

Valid reports whether value is a semantic version, with or without the v prefix. A pseudo-version from a build out of a checkout is one; the "(devel)" of a build that names no version is not, and nothing can be said about whether a release is newer than it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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