gosem

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 4 Imported by: 0

README

gosem

A package to adopt semver to better model the way the Go project represents versions with respect to toolchain releases. This is NOT a general purpose semver package.

This is copyrighted and made freely available under the terms of the MIT license.

Documentation

Overview

A package to adapt semver to better model the way the Go project represents versions with respect to toolchain releases. This is **NOT** a general purpose semver package.

Index

Constants

This section is empty.

Variables

View Source
var ErrBadVersionString = errors.New("invalid version string")

ErrBadVersionString meaning the version string is invalid

View Source
var ErrInvalidVersion = errors.New("invalid version")

ErrInvalidVersion is an error returned when the Version is not valid.

Functions

This section is empty.

Types

type Version

type Version struct {
	Major    uint64
	Minor    uint64
	Patch    int64
	Modifier string

} //struct

Version represents semantic versions of the Go toolchain packaging. The Go archives don't strictly follow the standard. For example the first version of 1.15 for Linux is named go1.15.linux-amd64.tar.gz instead of go1.15.0.linux-amd64.tar.gz. This type takes the slight deveations into account.

func MustParseVersion

func MustParseVersion(s string) *Version

MustParseVersion calls Parse and will panic is there is an error parsing the Version from the string.

func ParseVersion

func ParseVersion(s string) (*Version, error)

ParseVersion parses a Go style semver Version from a string.

func (Version) Less

func (v Version) Less(o *Version) bool

Less determines if this Version is less than the other Version. Prerelease versions (those with modifiers) preceed normal releases. Also the versions 1.15 and 1.15.0 are considered equal by this function.

func (Version) String

func (v Version) String() string

String returns a string representation of a Version. If String is called on an invalid Vesion it will panic. If a Version has a patch equal to zero, then the patch will be treated as if it was not set.

Jump to

Keyboard shortcuts

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