1
0
mirror of https://github.com/go-task/task.git synced 2025-11-06 09:09:13 +02:00

Fixed some bugs regarding minor version checks on version:

1. I have forgot to update it on recent releases. Seems that most people just
   use round versions since nobody complained.
2. It's too hard to understand how the github.com/Masterminds/semver package
   works, so I just got rid of it and we're now using plain float checks.
This commit is contained in:
Andrey Nering
2019-06-15 22:37:20 -03:00
parent 4cee4aa5a8
commit abe0352de9
4 changed files with 36 additions and 76 deletions

View File

@@ -1,58 +0,0 @@
package version
import (
"github.com/Masterminds/semver"
)
var (
v1 = mustVersion("1")
v2 = mustVersion("2")
v21 = mustVersion("2.1")
v22 = mustVersion("2.2")
v23 = mustVersion("2.3")
v24 = mustVersion("2.4")
v25 = mustVersion("2.5")
)
// IsV1 returns if is a given Taskfile version is version 1
func IsV1(v *semver.Constraints) bool {
return v.Check(v1)
}
// IsV2 returns if is a given Taskfile version is at least version 2
func IsV2(v *semver.Constraints) bool {
return v.Check(v2)
}
// IsV21 returns if is a given Taskfile version is at least version 2.1
func IsV21(v *semver.Constraints) bool {
return v.Check(v21)
}
// IsV22 returns if is a given Taskfile version is at least version 2.2
func IsV22(v *semver.Constraints) bool {
return v.Check(v22)
}
// IsV23 returns if is a given Taskfile version is at least version 2.3
func IsV23(v *semver.Constraints) bool {
return v.Check(v23)
}
// IsV24 returns if is a given Taskfile version is at least version 2.4
func IsV24(v *semver.Constraints) bool {
return v.Check(v24)
}
// IsV25 returns if is a given Taskfile version is at least version 2.5
func IsV25(v *semver.Constraints) bool {
return v.Check(v25)
}
func mustVersion(s string) *semver.Version {
v, err := semver.NewVersion(s)
if err != nil {
panic(err)
}
return v
}