diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-03-17 18:38:14 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-03-17 18:38:14 -0400 |
commit | 0f85e72d1331b49b52925d6cc5ad083a0376104c (patch) | |
tree | 9ba66e893d6f66096f6b06284d09c8eb3e50facc /lib/btrfs/btrfsprim | |
parent | c0f33186aa7a8903c5e7406024f13fad48cd14e3 (diff) | |
parent | 1ea26f04701fa66e36b058f3efb3a6c7059cdc5c (diff) |
Merge branch 'lukeshu/lint'
Diffstat (limited to 'lib/btrfs/btrfsprim')
-rw-r--r-- | lib/btrfs/btrfsprim/key.go | 14 | ||||
-rw-r--r-- | lib/btrfs/btrfsprim/misc.go | 2 |
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/btrfs/btrfsprim/key.go b/lib/btrfs/btrfsprim/key.go index b07cc8c..5580c52 100644 --- a/lib/btrfs/btrfsprim/key.go +++ b/lib/btrfs/btrfsprim/key.go @@ -21,7 +21,10 @@ type Key struct { const MaxOffset uint64 = math.MaxUint64 -// mimics print-tree.c:btrfs_print_key() +// Format returns a human-friendly string representation of the Key, +// according to which tree it appears in. +// +// The formatting of the key mimics print-tree.c:btrfs_print_key(). func (key Key) Format(tree ObjID) string { switch tree { case UUID_TREE_OBJECTID: @@ -39,12 +42,11 @@ func (key Key) Format(tree ObjID) string { return fmt.Sprintf("(%v %v -1)", key.ObjectID.Format(tree), key.ItemType) - } else { - return fmt.Sprintf("(%v %v %v)", - key.ObjectID.Format(tree), - key.ItemType, - key.Offset) } + return fmt.Sprintf("(%v %v %v)", + key.ObjectID.Format(tree), + key.ItemType, + key.Offset) } } diff --git a/lib/btrfs/btrfsprim/misc.go b/lib/btrfs/btrfsprim/misc.go index 38290d6..43ba306 100644 --- a/lib/btrfs/btrfsprim/misc.go +++ b/lib/btrfs/btrfsprim/misc.go @@ -2,6 +2,8 @@ // // SPDX-License-Identifier: GPL-2.0-or-later +// Package btrfsprim contains primitive btrfs datatypes, that all +// other btrfs sub-packages may make use of. package btrfsprim import ( |