https://github.com/loadsmart/calver-go
Parse and increment version based on calver.org strategy.
https://github.com/loadsmart/calver-go
Last synced: 8 months ago
JSON representation
Parse and increment version based on calver.org strategy.
- Host: GitHub
- URL: https://github.com/loadsmart/calver-go
- Owner: loadsmart
- Created: 2021-03-02T20:11:59.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-06T17:35:24.000Z (almost 2 years ago)
- Last Synced: 2025-03-28T10:47:32.651Z (about 1 year ago)
- Language: Go
- Homepage:
- Size: 22.5 KB
- Stars: 7
- Watchers: 55
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# calver-go - The Calendar Versioner for go
Parse and increment version based on [calver.org](https://calver.org/) strategy.
[](https://circleci.com/gh/loadsmart/calvergo)
Install
```shell
go get github.com/loadsmart/calver-go
```
Usage
```go
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](./LICENSE)