summaryrefslogtreecommitdiff
path: root/lib/util
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-07-13 20:41:10 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-07-13 21:39:09 -0600
commit952b677bf7f10da93673e3671f764c54c454bbfe (patch)
tree57b31c8f72f76d60b89e0307069c9d15c6794326 /lib/util
parent4e29bb393ec774f0a79c70d9d69c54fe4e8ecb72 (diff)
Move ordered.go to lib/containers
Something about this trips a stack overflow in golangci-lint, so upgrade golangci-lint to a commit that fixes this.
Diffstat (limited to 'lib/util')
-rw-r--r--lib/util/ordered.go41
1 files changed, 0 insertions, 41 deletions
diff --git a/lib/util/ordered.go b/lib/util/ordered.go
deleted file mode 100644
index fc5b5ee..0000000
--- a/lib/util/ordered.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com>
-//
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-package util
-
-import (
- "golang.org/x/exp/constraints"
-)
-
-func CmpUint[T constraints.Unsigned](a, b T) int {
- switch {
- case a < b:
- return -1
- case a == b:
- return 0
- default:
- return 1
- }
-}
-
-type Ordered[T interface{ Cmp(T) int }] interface {
- Cmp(T) int
-}
-
-type NativeOrdered[T constraints.Ordered] struct {
- Val T
-}
-
-func (a NativeOrdered[T]) Cmp(b NativeOrdered[T]) int {
- switch {
- case a.Val < b.Val:
- return -1
- case a.Val > b.Val:
- return 1
- default:
- return 0
- }
-}
-
-var _ Ordered[NativeOrdered[int]] = NativeOrdered[int]{}