Package semver offers a way to represent SemVer numbers in 32 bits.
These SemVer numbers are NOT spec compliant as defined on semver.org; as they do not hold prerelease or build information and the maximum values for the major, minor and patch components are 65,535, 255 and 255 respectively.
Use this package:
- if you don't need to store prerelease and/or build info
- if you are certain
- the Major component will never exceed 65,535
- the Minor and Patch components will never exceed 255
go get -u github.com/vilarfg/go-semver32
package name
import "github.com/vilarfg/go-semver32"
func Func() {
n, err := semver.ParseNumber("0.1.1")
if err != nil {
// handle error, though no error will be produced
// for that specific string.
}
fmt.Printf("%d is v%s", n, n) // => 257 is v0.1.1
}
MIT. Copyright © 2020 Fernando G. Vilar