diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-01 01:56:16 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-01 01:56:16 -0600 |
commit | 70fc3adf402eb956e6061fae75e46c46c1ad606d (patch) | |
tree | 5611c676dcb91405d7a327e42f664f2496107944 /pkg/btrfs/internal/uuid.go | |
parent | 3825cf60fd652f22acc438d50028701d27a7402d (diff) |
update main, kinda
Diffstat (limited to 'pkg/btrfs/internal/uuid.go')
-rw-r--r-- | pkg/btrfs/internal/uuid.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pkg/btrfs/internal/uuid.go b/pkg/btrfs/internal/uuid.go new file mode 100644 index 0000000..ff274d9 --- /dev/null +++ b/pkg/btrfs/internal/uuid.go @@ -0,0 +1,24 @@ +package internal + +import ( + "bytes" + "encoding/hex" + "strings" +) + +type UUID [16]byte + +func (uuid UUID) String() string { + str := hex.EncodeToString(uuid[:]) + return strings.Join([]string{ + str[:8], + str[8:12], + str[12:16], + str[16:20], + str[20:32], + }, "-") +} + +func (a UUID) Equal(b UUID) bool { + return bytes.Equal(a[:], b[:]) +} |