Skip to content

Commit ca6f619

Browse files
committed
Revert "pkg/ipnet: Add DeepCopy and DeepCopyInto for IPNet"
This reverts commit 06739c6, #276. Devan's forking the config in Hive [1], so they no longer need us to support embedding in Kubernetes objects. [1]: #256 (comment)
1 parent c855611 commit ca6f619

File tree

2 files changed

+0
-59
lines changed

2 files changed

+0
-59
lines changed

pkg/ipnet/ipnet.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,6 @@ func (ipnet *IPNet) String() string {
2525
return ipnet.IPNet.String()
2626
}
2727

28-
// DeepCopyInto copies the receiver into out. out must be non-nil.
29-
func (ipnet *IPNet) DeepCopyInto(out *IPNet) {
30-
if ipnet == nil {
31-
*out = *new(IPNet)
32-
} else {
33-
*out = *ipnet
34-
}
35-
return
36-
}
37-
38-
// DeepCopy copies the receiver, creating a new IPNet.
39-
func (ipnet *IPNet) DeepCopy() *IPNet {
40-
if ipnet == nil {
41-
return nil
42-
}
43-
out := new(IPNet)
44-
ipnet.DeepCopyInto(out)
45-
return out
46-
}
47-
4828
// MarshalJSON interface for an IPNet
4929
func (ipnet IPNet) MarshalJSON() (data []byte, err error) {
5030
if reflect.DeepEqual(ipnet.IPNet, emptyIPNet) {

pkg/ipnet/ipnet_test.go

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -56,42 +56,3 @@ func TestUnmarshal(t *testing.T) {
5656
})
5757
}
5858
}
59-
60-
func TestDeepCopy(t *testing.T) {
61-
for _, ipNetIn := range []*IPNet{
62-
{},
63-
{IPNet: net.IPNet{
64-
IP: net.IP{192, 168, 0, 10},
65-
Mask: net.IPv4Mask(255, 255, 255, 0),
66-
}},
67-
} {
68-
t.Run(ipNetIn.String(), func(t *testing.T) {
69-
t.Run("DeepCopyInto", func(t *testing.T) {
70-
ipNetOut := &IPNet{IPNet: net.IPNet{
71-
IP: net.IP{10, 0, 0, 0},
72-
Mask: net.IPv4Mask(255, 0, 0, 0),
73-
}}
74-
75-
ipNetIn.DeepCopyInto(ipNetOut)
76-
if ipNetOut.String() != ipNetIn.String() {
77-
t.Fatalf("%v != %v", ipNetOut, ipNetIn)
78-
}
79-
})
80-
81-
t.Run("DeepCopy", func(t *testing.T) {
82-
ipNetOut := ipNetIn.DeepCopy()
83-
if ipNetOut.String() != ipNetIn.String() {
84-
t.Fatalf("%v != %v", ipNetOut, ipNetIn)
85-
}
86-
87-
ipNetIn.IPNet = net.IPNet{
88-
IP: net.IP{192, 168, 10, 10},
89-
Mask: net.IPv4Mask(255, 255, 255, 255),
90-
}
91-
if ipNetOut.String() == ipNetIn.String() {
92-
t.Fatalf("%v (%q) == %v (%q)", ipNetOut, ipNetOut.String(), ipNetIn, ipNetIn.String())
93-
}
94-
})
95-
})
96-
}
97-
}

0 commit comments

Comments
 (0)