diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-07-12 16:23:43 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-07-12 16:23:43 -0600 |
commit | 2f28e21aef9be5755fa5f175bb74c9aa6548d1cc (patch) | |
tree | 76ff91e848003a6592b235cd882d23af5da0b3f5 /lib/btrfs/types_superblock.go | |
parent | 68555944f694e941b9cac3f8349364ec965db2fb (diff) |
lib/btrfs: Don't have errors stutter
Since ad9ac6d07ce1819260c2b7f090fd4fe742c80d9f binstruct itself wraps all
errors with the type and method; no need for the Node and SysChunk
.MarshalBinary and .UnmarshalBinary methods to also prefix the errors they
emit with that info.
Diffstat (limited to 'lib/btrfs/types_superblock.go')
-rw-r--r-- | lib/btrfs/types_superblock.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/btrfs/types_superblock.go b/lib/btrfs/types_superblock.go index a407501..30adb86 100644 --- a/lib/btrfs/types_superblock.go +++ b/lib/btrfs/types_superblock.go @@ -121,12 +121,12 @@ type SysChunk struct { func (sc SysChunk) MarshalBinary() ([]byte, error) { dat, err := binstruct.Marshal(sc.Key) if err != nil { - return dat, fmt.Errorf("%T.MarshalBinary: %w", sc, err) + return dat, err } _dat, err := binstruct.Marshal(sc.Chunk) dat = append(dat, _dat...) if err != nil { - return dat, fmt.Errorf("%T.MarshalBinary: %w", sc, err) + return dat, err } return dat, nil } @@ -134,12 +134,12 @@ func (sc SysChunk) MarshalBinary() ([]byte, error) { func (sc *SysChunk) UnmarshalBinary(dat []byte) (int, error) { n, err := binstruct.Unmarshal(dat, &sc.Key) if err != nil { - return n, fmt.Errorf("%T.UnmarshalBinary: %w", *sc, err) + return n, err } _n, err := binstruct.Unmarshal(dat[n:], &sc.Chunk) n += _n if err != nil { - return n, fmt.Errorf("%T.UnmarshalBinary: %w", *sc, err) + return n, err } return n, nil } |