vilarfg / go-semver32

Package semver offers a way to represent SemVer numbers in 32 bits.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-semver32

Sourcegraph Build Status codecov PkgGoDev rcard License

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

Installation

go get -u github.com/vilarfg/go-semver32

Usage

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
}

License

MIT. Copyright © 2020 Fernando G. Vilar

About

Package semver offers a way to represent SemVer numbers in 32 bits.

License:MIT License


Languages

Language:Go 100.0%