summaryrefslogtreecommitdiff
path: root/vendor/github.com/hashicorp/go-version/version_collection.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/go-version/version_collection.go')
-rw-r--r--vendor/github.com/hashicorp/go-version/version_collection.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/go-version/version_collection.go b/vendor/github.com/hashicorp/go-version/version_collection.go
new file mode 100644
index 00000000..cc888d43
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-version/version_collection.go
@@ -0,0 +1,17 @@
+package version
+
+// Collection is a type that implements the sort.Interface interface
+// so that versions can be sorted.
+type Collection []*Version
+
+func (v Collection) Len() int {
+ return len(v)
+}
+
+func (v Collection) Less(i, j int) bool {
+ return v[i].LessThan(v[j])
+}
+
+func (v Collection) Swap(i, j int) {
+ v[i], v[j] = v[j], v[i]
+}