Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 1.02 KB

README.md

File metadata and controls

44 lines (33 loc) · 1.02 KB

calver-go - The Calendar Versioner for go

Parse and increment version based on calver.org strategy.

CircleCI

Install

go get github.com/loadsmart/calver-go

Usage

import "github.com/loadsmart/calver-go/calver"

latest, err := calver.Parse("YYYY.MM.DD.MICRO", "2019.11.27.1")
micro := latest.Next() // if today is 11/27/2019 then version == 2019.11.27.2
major := latest.Next() // if today is 11/28/2019 then version == 2019.11.28.1

brandNewVersion := calver.NewVersion('YYYY.MM.DD.MICRO', 0) // if today is 11/28/2019 then version == 2019.11.28.1
brandNewVersion.String() // "2019.11.28.1"

Caveats

  • support only the conventions below:
    • YYYY
    • YY
    • 0Y
    • MM
    • M0
    • 0M
    • DD
    • D0
    • 0D
    • MICRO (a.k.a build)

TODO

  • export as command-line tool
  • add support to other conventions

License

MIT