Skip to content

slantview/go-semver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

go-semver

Build Status Coverage Status GoDoc

A library for using semantic versioning in Go.

Example Usage

s, err := semver.NewVersion("1.0.0")
if err != nil {
    fmt.Printf("Unable to parse version: %s", err)
}

fmt.Printf("%s", s.String())
// "1.0.0"

s.BumpPatch()
fmt.Printf("%s", s.String())
// "1.0.1"

s.BumpMinor()
fmt.Printf("%s", s.String())
// "1.1.0"

s.BumpMajor()
fmt.Printf("%s", s.String())
// "2.0.0"

s.SetPrerelease("alpha")
fmt.Printf("%s", s.String())
// "2.0.0-alpha.1"

s.BumpPrerelease()
fmt.Printf("%s", s.String())
// "2.0.0-alpha.2"

s.SetMetadata("build")
fmt.Printf("%s", s.String())
// "2.0.0+build.1"

s.BumpBuild()
fmt.Printf("%s", s.String())
// "2.0.0+build.2"

v1, _ := semver.NewVersion("1.0.0")
v2, _ := semver.NewVersion("1.0.1")

v1.LessThan(v2) // true
v1.GreaterThan(v2) // false
v1.Equals(v2) // false

Author: Steve Rude steve@slantview.com

About

Semantic versioning library for Go.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages