Skip to content

Commit

Permalink
refactor: refactor String method in Bytes type
Browse files Browse the repository at this point in the history
- Remove unnecessary if statement in the String method of the Bytes type

Signed-off-by: Sean Zheng <[email protected]>
  • Loading branch information
blackhorseya committed Nov 22, 2023
1 parent 784a281 commit 1ba22d6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/types/bytes.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ type Bytes []byte

// String Converts to hex string
func (b Bytes) String() string {
if len(b) == 0 {
return ""
}

return fmt.Sprintf("0x%s", hex.EncodeToString(b))
}

Expand Down

0 comments on commit 1ba22d6

Please sign in to comment.