version

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNumberOfAdditionalCommitsIsTooLarge = errors.New("number of additional commits is too large")

ErrNumberOfAdditionalCommitsIsTooLarge is produced by MakeVersionQuad when the number of additional commits is out of range.

View Source
var ErrReleaseNumberIsTooLarge = errors.New("release number is too large")

ErrReleaseNumberIsTooLarge is produced by MakeVersionQuad when numeric suffix is out of range.

View Source
var ErrUnsupportedPR = errors.New("unsupported pre-release content")

ErrUnsupportedPR is produced by MakeVersionQuad for unsupported pre-release suffixes.

View Source
var ErrVersionNumberIsTooLarge = errors.New("version number is too large")

ErrVersionNumberIsTooLarge is produced by MakeVersionQuad when one of the numbers is out of range.

Functions

This section is empty.

Types

type Quad

Quad can be used to form version quads from semantic versions. These are required for embedding numeric versions into Windows resources.

func MakeQuad

func MakeQuad(v Semantic, additionalCommits int) (Quad, error)

MakeQuad constructs a version quad from a semantic version and the number of additional commits.

To keep the numbers consistent with Win32 storage (2-bytes per number), this function will reject certain inputs where numbers are too large

The first triplet is taken from the semantic version, the Build number is formed as:

  • alphas ('alpha', 'a' PR suffixes): are 10000+ numbers
  • betas ('beta', 'b' PR suffixes): are 20000+ numbers
  • release candidates ('rc' suffixes): are 30000+ numbers
  • releases (no suffixes): are 50000+ numbers

The .<number> after the PR suffix, if present is multiplied by a 100 and added to the Build number. Same works for releases with -<number> suffix.

The number of additional commits is added to the Build number.

Examples:

  • v1.0.0-alpha -> 1.0.0.10000
  • v1.0.0-alpha.1 -> 1.0.0.10100
  • v1.0.0-alpha.1 + 7 commits -> 1.0.0.10107
  • v1.0.0-rc.5 -> 1.0.0.30500
  • v1.0.0 -> 1.0.0.50000
  • v1.0.0-5 -> 1.0.0.50005

see stats-test.go for more examples

func (Quad) CommaSeparatedString

func (v Quad) CommaSeparatedString() string

CommaSeparatedString produces #,#,#,# output, this is useful when code-generating Win32 resources

func (Quad) String

func (v Quad) String() string

String implements a stringer interface, producing #.#.#.# output

type Semantic

type Semantic = semver.Version

Semantic is an alias for semver.Version

Jump to

Keyboard shortcuts

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