Skip to content

Commit 66cc800

Browse files
committed
Fix slice copying
1 parent 4d8cf28 commit 66cc800

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/controller/status/status_setters.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func newHTTPRouteStatusSetter(status gatewayv1.HTTPRouteStatus, gatewayCtlrName
8585

8686
// keep all the parent statuses that belong to other controllers
8787
newParents := make([]gatewayv1.RouteParentStatus, 0, len(status.Parents))
88-
copy(newParents, status.Parents)
88+
newParents = append(newParents, status.Parents...)
8989
for _, os := range hr.Status.Parents {
9090
if string(os.ControllerName) != gatewayCtlrName {
9191
newParents = append(newParents, os)
@@ -111,7 +111,7 @@ func newTLSRouteStatusSetter(status v1alpha2.TLSRouteStatus, gatewayCtlrName str
111111

112112
// keep all the parent statuses that belong to other controllers
113113
newParents := make([]gatewayv1.RouteParentStatus, 0, len(status.Parents))
114-
copy(newParents, status.Parents)
114+
newParents = append(newParents, status.Parents...)
115115
for _, os := range tr.Status.Parents {
116116
if string(os.ControllerName) != gatewayCtlrName {
117117
newParents = append(newParents, os)
@@ -137,7 +137,7 @@ func newGRPCRouteStatusSetter(status gatewayv1.GRPCRouteStatus, gatewayCtlrName
137137

138138
// keep all the parent statuses that belong to other controllers
139139
newParents := make([]gatewayv1.RouteParentStatus, 0, len(status.Parents))
140-
copy(newParents, status.Parents)
140+
newParents = append(newParents, status.Parents...)
141141
for _, os := range gr.Status.Parents {
142142
if string(os.ControllerName) != gatewayCtlrName {
143143
newParents = append(newParents, os)

0 commit comments

Comments
 (0)