summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/btrfs/util.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/btrfs/util.go b/pkg/btrfs/util.go
index 04462f8..312ec75 100644
--- a/pkg/btrfs/util.go
+++ b/pkg/btrfs/util.go
@@ -1,5 +1,9 @@
package btrfs
+import (
+ "golang.org/x/exp/constraints"
+)
+
func inSlice[T comparable](needle T, haystack []T) bool {
for _, straw := range haystack {
if needle == straw {
@@ -8,3 +12,10 @@ func inSlice[T comparable](needle T, haystack []T) bool {
}
return false
}
+
+func max[T constraints.Ordered](a, b T) T {
+ if a > b {
+ return a
+ }
+ return b
+}