Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
import (
"github.com/mcuadros/go-version"
)version.Normalize("10.4.13-b")10.4.13.0-betaversion.CompareSimple("1.2", "1.0.1")1version.CompareSimple("1.0rc1", "1.0")-1version.Compare("1.0-dev", "1.0", "<")trueversion.Compare("1.0rc1", "1.0", ">=")falseversion.Compare("2.3.4", "v3.1.2", "<")trueVersion Constraints¶
c := version.NewConstrainGroupFromString(">2.0,<=3.0")
c.Match("2.5.0beta")
//Returns: true
c := version.NewConstrainGroupFromString("~1.2.3")
c.Match("1.2.3.5")
//Returns: trueSort Versions¶
arr := []string{"1.10-dev", "1.0rc1", "1.0", "1.0-dev"}
arr[1.10-dev 1.0rc1 1.0 1.0-dev]version.Sort(arr)
arr[1.0-dev 1.0rc1 1.0 1.10-dev]