mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-19 01:47:43 +08:00

Buildx currently returns the Docker Engine version for the docker driver and it can be confusing. This is because BuildKit before 0.11 version does not support the Info API that returns the BuildKit version. This change resolves the BuildKit version from the Docker engine one. Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
25 lines
729 B
Go
25 lines
729 B
Go
package semver
|
|
|
|
// Collection is a collection of Version instances and implements the sort
|
|
// interface. See the sort package for more details.
|
|
// https://golang.org/pkg/sort/
|
|
type Collection []*Version
|
|
|
|
// Len returns the length of a collection. The number of Version instances
|
|
// on the slice.
|
|
func (c Collection) Len() int {
|
|
return len(c)
|
|
}
|
|
|
|
// Less is needed for the sort interface to compare two Version objects on the
|
|
// slice. If checks if one is less than the other.
|
|
func (c Collection) Less(i, j int) bool {
|
|
return c[i].LessThan(c[j])
|
|
}
|
|
|
|
// Swap is needed for the sort interface to replace the Version objects
|
|
// at two different positions in the slice.
|
|
func (c Collection) Swap(i, j int) {
|
|
c[i], c[j] = c[j], c[i]
|
|
}
|