versionutils

package
v0.10.8 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2019 License: Apache-2.0 Imports: 12 Imported by: 26

Documentation

Index

Constants

View Source
const (
	SemverNilVersionValue = "v0.0.0"
	SemverMinimumVersion  = "v0.0.1"
)

SemverLowerBound is the "nil" value for changelog versions It is not itself a valid version but it allows us to use our semver validation on the v0.0.1 edge case

Variables

View Source
var (
	UnableToFindVersionInTomlError = func(pkgName string) error {
		return fmt.Errorf("unable to find version for %s in toml", pkgName)
	}
	FailedCommandError = func(err error, args []string, output string) error {
		return errors.Wrapf(err, "%v failed: %s", args, output)
	}
)
View Source
var (
	Zero = Version{
		Major: 0,
		Minor: 0,
		Patch: 0,
	}

	StableApiVersion = Version{
		Major: 1,
		Minor: 0,
		Patch: 0,
	}
)

Functions

func GetDependencyVersionInfo added in v0.10.8

func GetDependencyVersionInfo(pkgName string, toml *TomlWrapper) (*dep.VersionInfo, error)

Returns the version of the given package together with the type of version identifier, i.e. revision, version, branch.

func GetGitVersion deprecated

func GetGitVersion(relativeRepoDir string) (string, error)

Deprecated: use git.GetGitRefInfo

func GetImageVersion added in v0.9.7

func GetImageVersion(version *Version) string

func GetTag deprecated

func GetTag(version string) string

Deprecated: use git.AppendTagPrefix

func GetTomlVersion deprecated

func GetTomlVersion(pkgName string, toml *TomlWrapper) (string, error)

Deprecated: use GetDependencyVersionInfo

func GetVersion deprecated

func GetVersion(pkgName string, tomlTree []*toml.Tree) (string, error)

Deprecated: Use GetTomlVersion instead

func GetVersionFromTag

func GetVersionFromTag(shouldBeAVersion string) (string, error)

func IsGreaterThanTag

func IsGreaterThanTag(greaterTag, lesserTag string) (bool, error)

func MatchesRegex

func MatchesRegex(tag string) bool

func ParseToml deprecated

func ParseToml() ([]*toml.Tree, error)

Deprecated: Use ParseFullToml instead

func ParseTomlFromDir deprecated

func ParseTomlFromDir(relativeDir string) ([]*toml.Tree, error)

Deprecated: Use ParseFullTomlFromDir instead

func ParseTomlOverrides deprecated

func ParseTomlOverrides() ([]*toml.Tree, error)

Deprecated: Use ParseFullToml instead

func ParseTomlOverridesFromDir deprecated

func ParseTomlOverridesFromDir(relativeDir string) ([]*toml.Tree, error)

Deprecated: Use ParseFullTomlFromDir instead

func PinGitVersion deprecated

func PinGitVersion(relativeRepoDir string, semVerVersion string) error

Deprecated: use git.PinDependencyVersion This function prepends a "v" to the semver and then tries to 'git checkout' the resulting tag in the given directory.

Types

type TomlWrapper

type TomlWrapper struct {
	Overrides   []*toml.Tree
	Constraints []*toml.Tree
}

func ParseFullToml

func ParseFullToml() (*TomlWrapper, error)

func ParseFullTomlFromDir

func ParseFullTomlFromDir(relativeDir string) (*TomlWrapper, error)

type Version

type Version struct {
	Major int
	Minor int
	Patch int
}

func GetReleaseVersionOrExitGracefully

func GetReleaseVersionOrExitGracefully() *Version

func NewVersion

func NewVersion(major, minor, patch int) *Version

func ParseVersion

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

func (*Version) Equals

func (v *Version) Equals(other *Version) bool

func (*Version) IncrementVersion

func (v *Version) IncrementVersion(breakingChange bool) *Version

func (*Version) IsGreaterThan

func (v *Version) IsGreaterThan(lesser *Version) bool

func (*Version) IsGreaterThanOrEqualTo

func (v *Version) IsGreaterThanOrEqualTo(lesser *Version) (bool, error)

func (*Version) String

func (v *Version) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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