A Semantic Versioning library for Go.
❗ Still in heavy development and is not ready for usage. Please wait for the 1.0 release ❗
Covers version 2.0.0
of the semver specification.
Documentation on the syntax for the Satifies()
method can be found here.
go get github.com/hansrodtang/semver
For those who prefer it, you can also use gopkg.in:
go get gopkg.in/hansrodtang/semver.v0
import github.com/hansrodtang/semver
v1, error := semver.New("1.5.0")
// do something with error
if v1.Satisfies("^1.0.0") {
// do something
}
Test | Iterations | Time |
---|---|---|
BenchmarkParseSimple | 5000000 | 349 ns/op |
BenchmarkParseComplex | 1000000 | 1811 ns/op |
BenchmarkCompareSimple | 500000000 | 3.85 ns/op |
BenchmarkCompareComplex | 100000000 | 17.3 ns/op |
Run the benchmarks yourself with:
go test github.com/hansrodtang/semver -bench=.
Run the tests with:
go test -cover github.com/hansrodtang/semver
This software is licensed under the MIT license.