Documentation ¶
Overview ¶
Package bump_version makes it easy to parse and update version numbers in Go source files.
Index ¶
Constants ¶
const ( Major = VersionType("major") Minor = VersionType("minor") Patch = VersionType("patch") )
const VERSION = "2.5"
Variables ¶
This section is empty.
Functions ¶
func ValidVersionType ¶
func ValidVersionType(vtype VersionType) bool
Types ¶
type Version ¶
type Version struct { Major int64 // May be "-1" to signify that this version field is unused. Minor int64 Patch int64 }
func Bump ¶
func Bump(version Version, vtype VersionType) Version
Bump increments the version number by the given vtype (major/minor/patch). Bump panics if vtype is not a known VersionType.
func BumpInFile ¶
func BumpInFile(vtype VersionType, filename string) (Version, error)
BumpInFile finds a constant named VERSION, version, or Version in the file with the given filename, increments the version per the given VersionType, and writes the file back to disk. Returns the incremented Version object.
func Parse ¶
Parse parses a version string of the forms "2", "2.3", or "0.10.11". Any information after the third number ("2.0.0-beta") is discarded. Very little effort is taken to validate the input.
If a field is omitted from the string version (e.g. "0.2"), it's stored in the Version struct as the integer -1.
type VersionType ¶
type VersionType string