diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-05 10:03:08 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-05 21:01:58 -0700 |
commit | 0ff1d420f21101a92d8da888d491860cf0cf16cc (patch) | |
tree | 3e5715b4e4fd6619f2edddf5bab315cb9a125598 /lib/btrfs/btrfstree | |
parent | 53d7fbb73869eb5defa1ca5c52b26abd346b13b9 (diff) |
containers: s/Cmp/Compare/ to match the standard library
Go 1.18 added net/netip.Addr.Compare, and Go 1.20 added time.Time.Compare.
Diffstat (limited to 'lib/btrfs/btrfstree')
-rw-r--r-- | lib/btrfs/btrfstree/ops.go | 2 | ||||
-rw-r--r-- | lib/btrfs/btrfstree/root.go | 2 | ||||
-rw-r--r-- | lib/btrfs/btrfstree/types_node.go | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/btrfs/btrfstree/ops.go b/lib/btrfs/btrfstree/ops.go index 537773a..cdacef9 100644 --- a/lib/btrfs/btrfstree/ops.go +++ b/lib/btrfs/btrfstree/ops.go @@ -481,7 +481,7 @@ func KeySearch(fn func(btrfsprim.Key) int) func(btrfsprim.Key, uint32) int { // TreeLookup implements the 'Trees' interface. func (fs TreeOperatorImpl) TreeLookup(treeID btrfsprim.ObjID, key btrfsprim.Key) (Item, error) { - item, err := fs.TreeSearch(treeID, KeySearch(key.Cmp)) + item, err := fs.TreeSearch(treeID, KeySearch(key.Compare)) if err != nil { err = fmt.Errorf("item with key=%v: %w", key, err) } diff --git a/lib/btrfs/btrfstree/root.go b/lib/btrfs/btrfstree/root.go index 6ec45b5..319904b 100644 --- a/lib/btrfs/btrfstree/root.go +++ b/lib/btrfs/btrfstree/root.go @@ -30,7 +30,7 @@ func RootItemSearchFn(treeID btrfsprim.ObjID) func(btrfsprim.Key, uint32) int { ObjectID: treeID, ItemType: btrfsitem.ROOT_ITEM_KEY, Offset: 0, - }.Cmp(key) + }.Compare(key) } } diff --git a/lib/btrfs/btrfstree/types_node.go b/lib/btrfs/btrfstree/types_node.go index a26215b..d9d7118 100644 --- a/lib/btrfs/btrfstree/types_node.go +++ b/lib/btrfs/btrfstree/types_node.go @@ -507,11 +507,11 @@ func ReadNode[Addr ~int64](fs diskio.File[Addr], sb Superblock, addr Addr, exp N if nodeRef.Data.Head.NumItems == 0 { errs = append(errs, fmt.Errorf("has no items")) } else { - if minItem, _ := nodeRef.Data.MinItem(); exp.MinItem.OK && exp.MinItem.Val.Cmp(minItem) > 0 { + if minItem, _ := nodeRef.Data.MinItem(); exp.MinItem.OK && exp.MinItem.Val.Compare(minItem) > 0 { errs = append(errs, fmt.Errorf("expected minItem>=%v but node has minItem=%v", exp.MinItem, minItem)) } - if maxItem, _ := nodeRef.Data.MaxItem(); exp.MaxItem.OK && exp.MaxItem.Val.Cmp(maxItem) < 0 { + if maxItem, _ := nodeRef.Data.MaxItem(); exp.MaxItem.OK && exp.MaxItem.Val.Compare(maxItem) < 0 { errs = append(errs, fmt.Errorf("expected maxItem<=%v but node has maxItem=%v", exp.MaxItem, maxItem)) } |