version

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Filename names the version file
	Filename = "version.json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Version

type Version struct {
	Major int    `json:"major"`
	Minor int    `json:"minor"`
	Patch int    `json:"patch"`
	Pre   string `json:"pre"`
	Build string `json:"build"`
}

Version Basic SemVer structure

func New

func New() (v Version)

New returns an initial version

func (*Version) Equals

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

Equals checks if two versions are identical

func (*Version) EqualsString

func (v *Version) EqualsString(s string) (ok bool, err error)

EqualsString checks if version is identical to string

func (*Version) LoadFrom

func (v *Version) LoadFrom(path string) (err error)

LoadFrom loads the version file from the given path

func (*Version) LoadFromRoot

func (v *Version) LoadFromRoot() error

LoadFromRoot loads version from file at the root level

func (*Version) LoadFromRuntime

func (v *Version) LoadFromRuntime() error

LoadFromRuntime loads version using the stored runtime values

func (*Version) LoadFromTag

func (v *Version) LoadFromTag(noFetch bool) error

LoadFromTag loads the version from the latest tag

func (*Version) Parse

func (v *Version) Parse(s string) error

Parse parses a version string into its fields

func (*Version) Read

func (v *Version) Read(b []byte) (err error)

Read reads the version from the given bytes

func (*Version) SaveTo

func (v *Version) SaveTo(path string) (err error)

SaveTo saves the version file to the given path

func (*Version) SaveToRoot

func (v *Version) SaveToRoot() error

SaveToRoot saves the verstion file to the root directory

func (*Version) String

func (v *Version) String() (out string)

String returns the version string

func (*Version) StringNoV

func (v *Version) StringNoV() (out string)

StringNoV returns the version string, without a "v" prefix

Jump to

Keyboard shortcuts

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