Skip to content

Commit 939af88

Browse files
committed
common: remove Clone
1 parent 0b103bb commit 939af88

File tree

2 files changed

+0
-32
lines changed

2 files changed

+0
-32
lines changed

common/types.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -339,15 +339,6 @@ func (a Address) Value() (driver.Value, error) {
339339
return a[:], nil
340340
}
341341

342-
// Clone returns a pointer to a copy of [a] (or nil if [a] is nil)
343-
func (a *Address) Clone() *Address {
344-
if a == nil {
345-
return nil
346-
}
347-
cpy := *a
348-
return &cpy
349-
}
350-
351342
// ImplementsGraphQLType returns true if Hash implements the specified GraphQL type.
352343
func (a Address) ImplementsGraphQLType(name string) bool { return name == "Address" }
353344

common/types_test.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -453,29 +453,6 @@ func TestAddress_Format(t *testing.T) {
453453
}
454454
}
455455

456-
func TestCopyAddress(t *testing.T) {
457-
addrBytes := make([]byte, 20)
458-
addr := BytesToAddress(addrBytes)
459-
if !bytes.Equal(addr.Bytes(), addrBytes) {
460-
t.Fatalf("Expected original address bytes to be unmodified")
461-
}
462-
addrPtr := &addr
463-
cpy := addrPtr.Clone()
464-
cpy.SetBytes([]byte("deadbeef"))
465-
if !bytes.Equal(addr.Bytes(), addrBytes) {
466-
t.Fatal("Expected original address bytes to be unmodified")
467-
}
468-
if bytes.Equal(cpy.Bytes(), addrBytes) {
469-
t.Fatal("Expected modified address to no longer match original byte slice")
470-
}
471-
472-
var nilAddr *Address
473-
copiedNilAddr := nilAddr.Clone()
474-
if copiedNilAddr != nil {
475-
t.Fatalf("Expected copied nil address to be nil, but got %s", copiedNilAddr)
476-
}
477-
}
478-
479456
func TestHash_Format(t *testing.T) {
480457
var hash Hash
481458
hash.SetBytes([]byte{

0 commit comments

Comments
 (0)