Update types.go

This commit is contained in:
Justin 2025-11-25 22:57:19 +01:00 committed by GitHub
parent 385bae25d8
commit 98d305f0fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -110,7 +110,8 @@ func (h Hash) String() string {
// Hash supports the %v, %s, %q, %x, %X and %d format verbs. // Hash supports the %v, %s, %q, %x, %X and %d format verbs.
func (h Hash) Format(s fmt.State, c rune) { func (h Hash) Format(s fmt.State, c rune) {
hexb := make([]byte, 2+len(h)*2) hexb := make([]byte, 2+len(h)*2)
copy(hexb, "0x") hexb[0] = '0'
hexb[1] = 'x'
hex.Encode(hexb[2:], h[:]) hex.Encode(hexb[2:], h[:])
switch c { switch c {
@ -290,7 +291,8 @@ func (a *Address) checksumHex() []byte {
func (a Address) hex() []byte { func (a Address) hex() []byte {
var buf [len(a)*2 + 2]byte var buf [len(a)*2 + 2]byte
copy(buf[:2], "0x") buf[0] = '0'
buf[1] = 'x'
hex.Encode(buf[2:], a[:]) hex.Encode(buf[2:], a[:])
return buf[:] return buf[:]
} }