diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-11 13:52:02 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-11 22:31:33 -0600 |
commit | 468eca4684d9b51d00e18cb129bebf528a844035 (patch) | |
tree | 85191e6ff392833d737370a20a9b119e6139e04f /pkg/btrfs/crc32c.go | |
parent | 5cecda729a22bcca9b1fa8234dd03140c0380720 (diff) |
Improve formatting of CSums and UUIDs
Diffstat (limited to 'pkg/btrfs/crc32c.go')
-rw-r--r-- | pkg/btrfs/crc32c.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/btrfs/crc32c.go b/pkg/btrfs/crc32c.go index ab2d6e9..52058e8 100644 --- a/pkg/btrfs/crc32c.go +++ b/pkg/btrfs/crc32c.go @@ -2,14 +2,21 @@ package btrfs import ( "encoding/binary" + "encoding/hex" "fmt" "hash/crc32" + + "lukeshu.com/btrfs-tools/pkg/util" ) type CSum [0x20]byte func (csum CSum) String() string { - return fmt.Sprintf("%x", [0x20]byte(csum)) + return hex.EncodeToString(csum[:]) +} + +func (csum CSum) Format(f fmt.State, verb rune) { + util.FormatByteArrayStringer(csum, csum[:], f, verb) } func CRC32c(data []byte) CSum { |