A golang Semantic Versioning tool that follows the Semver Specification
This tool can be used as a command line utility or as a golang package for use within other projects.
go get github.com/rokane/semver
As a command line utility:
A Golang implementation of the http://semver.org/ specification
Usage:
semver [options] <version> [<version> [...]]
Options:
-r <range>
Print versions that match the specified range.
-i <level>
Increment a version by the specified level. Level can
be one of: major, minor, patch, premajor, preminor,
prepatch, or prerelease. Only one version may be specified.
-preid <identifier>
Identifier to be used to prefix premajor, preminor,
prepatch or prerelease version increments.
-build <buildmeta>
Metadata to be used to attached to the incremented version.
As a golang package:
import "github/rokane/semver"
version := Version{
Major: 1,
Minor: 0,
Patch: 0,
PreID: "preidentifier"
BuildMeta: "metadata",
}
// Increment
version.IncrementMajor()
version.IncrementMinor()
version.IncrementPatch()
// Output to String
version.String()