Skip to content

Commit

Permalink
fix: golangci-lint errcheck on address populateFromBytes
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Gianelloni <[email protected]>
  • Loading branch information
wolf31o2 committed Mar 11, 2024
1 parent ab74d22 commit 0e7bebb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 8 additions & 2 deletions ledger/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,10 @@ func NewAddress(addr string) (Address, error) {
return Address{}, err
}
a := Address{}
a.populateFromBytes(decoded)
err = a.populateFromBytes(decoded)
if err != nil {
return Address{}, err
}
return a, nil
}

Expand Down Expand Up @@ -295,7 +298,10 @@ func (a *Address) UnmarshalCBOR(data []byte) error {
if _, err := cbor.Decode(data, &tmpData); err != nil {
return err
}
a.populateFromBytes(tmpData)
err := a.populateFromBytes(tmpData)
if err != nil {
return err
}
return nil
}

Expand Down
8 changes: 7 additions & 1 deletion ledger/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,13 @@ func TestAddressFromBytes(t *testing.T) {
}
for _, testDef := range testDefs {
addr := Address{}
addr.populateFromBytes(test.DecodeHexString(testDef.addressBytesHex))
err := addr.populateFromBytes(test.DecodeHexString(testDef.addressBytesHex))
if err != nil {
t.Fatalf(
"failure populating address from bytes: %s",
err,
)
}
if addr.String() != testDef.expectedAddress {
t.Fatalf(
"address did not match expected value, got: %s, wanted: %s",
Expand Down

0 comments on commit 0e7bebb

Please sign in to comment.