Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
In [1]:
import (
"github.com/mcuadros/go-version"
)
In [3]:
version.Normalize("10.4.13-b")
Out[3]:
In [4]:
version.CompareSimple("1.2", "1.0.1")
Out[4]:
In [5]:
version.CompareSimple("1.0rc1", "1.0")
Out[5]:
In [6]:
version.Compare("1.0-dev", "1.0", "<")
Out[6]:
In [7]:
version.Compare("1.0rc1", "1.0", ">=")
Out[7]:
In [8]:
version.Compare("2.3.4", "v3.1.2", "<")
Out[8]:
Version Constraints¶
In [ ]:
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: true
Sort Versions¶
In [12]:
arr := []string{"1.10-dev", "1.0rc1", "1.0", "1.0-dev"}
arr
Out[12]:
In [13]:
version.Sort(arr)
arr
Out[13]:
References¶
In [ ]: