goversion

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package goversion contains utilities to parse and store a Go toolset version. It also handles extra parts that are used by the Microsoft build of Go to describe how it was built.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoVersion

type GoVersion struct {
	// Original is the source data, without any defaults filled in.
	Original string

	// Major is the major version in semver terms, as in "Go 1".
	Major string
	// Minor is the minor version, referred to by Go as "major releases". Default: 0
	Minor string
	// Patch is the patch version, referred to by Go as "minor revisions". Default: 0.
	Patch string
	// Revision is an integer immediately after the first '-' (if any). These are revisions of the
	// Microsoft build and aren't associated with official Go releases. Default: 1.
	Revision string
	// Note is a non-integer string after a '-' separator, or not included. Common use is to
	// specify 'fips'. Default: empty string, indicating not provided.
	Note string
	// Prerelease is a beta or rc version string, for example "rc1" in "1.18rc1" or "beta1" in
	// "2beta1". After normal parsing, the major, minor, and patch version strings are scanned for a
	// non-numeric section. If one is found, it is removed from that part of the version and stored
	// in Prerelease.
	Prerelease string
}

GoVersion is the parsed representation of a Microsoft-built Go toolset version.

func New

func New(v string) *GoVersion

New parses a version string. Any parts left blank are filled in with default values.

func (*GoVersion) Full

func (v *GoVersion) Full() string

Full returns the full normalized version string, including Note if specified.

func (*GoVersion) MajorMinor

func (v *GoVersion) MajorMinor() string

func (*GoVersion) MajorMinorPatch

func (v *GoVersion) MajorMinorPatch() string

func (*GoVersion) MajorMinorPatchPrerelease

func (v *GoVersion) MajorMinorPatchPrerelease() string

func (*GoVersion) MajorMinorPatchPrereleaseRevision

func (v *GoVersion) MajorMinorPatchPrereleaseRevision() string

func (*GoVersion) MajorMinorPrerelease

func (v *GoVersion) MajorMinorPrerelease() string

func (*GoVersion) NoteWithPrefix

func (v *GoVersion) NoteWithPrefix() string

NoteWithPrefix is a utility to help with version string construction. Returns Note with a "-" prefix, or empty string if Note isn't specified.

func (*GoVersion) String

func (v *GoVersion) String() string

func (*GoVersion) UpstreamFormatGitTag

func (v *GoVersion) UpstreamFormatGitTag() string

UpstreamFormatGitTag returns the version in the format upstream uses for Git tags.

Jump to

Keyboard shortcuts

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