version

package
v0.56.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 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

func GetBuildInfo added in v0.56.2

func GetBuildInfo() (rev string, t time.Time, mod bool, err error)

GetBuildInfo returns the embedded vcs-related information

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) Load added in v0.56.1

func (v *Version) Load() (err error)

Load loads the version file from the current working directory

func (*Version) LoadFrom

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

LoadFrom loads the version file from the given directory

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) Save added in v0.56.1

func (v *Version) Save() (err error)

Save saves the version file to the current working directory

func (*Version) SaveTo

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

SaveTo saves the version file to the given directory

func (*Version) String

func (v *Version) String() 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