Browse Source

Added Versions

v0
maze 4 years ago
parent
commit
1ea931aa35
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      version/version.go

+ 15
- 0
version/version.go View File

@ -55,6 +55,21 @@ func (v Version) LessThan(other Version) bool {
return Compare(v, other) < 0
}
// Versions is a sort.Sortable slice of Version
type Versions []Version
func (vs Versions) Len() int {
return len(vs)
}
func (vs Versions) Less(i, j int) bool {
return vs[i].LessThan(vs[j])
}
func (vs Versions) Swap(i, j int) {
vs[i], vs[j] = vs[j], vs[i]
}
var alphanumPattern = regexp.MustCompile("([a-zA-Z]+)|([0-9]+)|(~)")
// rpmvercmp implements https://github.com/rpm-software-management/rpm/blob/master/lib/rpmvercmp.c


Loading…
Cancel
Save