Skip to content

Commit

Permalink
fix: remove no needed new pointer creation (#2739)
Browse files Browse the repository at this point in the history
fix: remove no needed new pointer

Signed-off-by: bitliu <bitliu@tencent.com>
  • Loading branch information
Xunzhuo authored Apr 11, 2024
1 parent a24263c commit b608831
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions internal/gatewayapi/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,37 +123,31 @@ func (r *Runner) subscribeAndTranslate(ctx context.Context) {

// Update Status
for _, gateway := range result.Gateways {
gateway := gateway
key := utils.NamespacedName(gateway)
r.ProviderResources.GatewayStatuses.Store(key, &gateway.Status)
delete(statusesToDelete.GatewayStatusKeys, key)
}
for _, httpRoute := range result.HTTPRoutes {
httpRoute := httpRoute
key := utils.NamespacedName(httpRoute)
r.ProviderResources.HTTPRouteStatuses.Store(key, &httpRoute.Status)
delete(statusesToDelete.HTTPRouteStatusKeys, key)
}
for _, grpcRoute := range result.GRPCRoutes {
grpcRoute := grpcRoute
key := utils.NamespacedName(grpcRoute)
r.ProviderResources.GRPCRouteStatuses.Store(key, &grpcRoute.Status)
delete(statusesToDelete.GRPCRouteStatusKeys, key)
}
for _, tlsRoute := range result.TLSRoutes {
tlsRoute := tlsRoute
key := utils.NamespacedName(tlsRoute)
r.ProviderResources.TLSRouteStatuses.Store(key, &tlsRoute.Status)
delete(statusesToDelete.TLSRouteStatusKeys, key)
}
for _, tcpRoute := range result.TCPRoutes {
tcpRoute := tcpRoute
key := utils.NamespacedName(tcpRoute)
r.ProviderResources.TCPRouteStatuses.Store(key, &tcpRoute.Status)
delete(statusesToDelete.TCPRouteStatusKeys, key)
}
for _, udpRoute := range result.UDPRoutes {
udpRoute := udpRoute
key := utils.NamespacedName(udpRoute)
r.ProviderResources.UDPRouteStatuses.Store(key, &udpRoute.Status)
delete(statusesToDelete.UDPRouteStatusKeys, key)
Expand All @@ -173,23 +167,20 @@ func (r *Runner) subscribeAndTranslate(ctx context.Context) {
}

for _, clientTrafficPolicy := range result.ClientTrafficPolicies {
clientTrafficPolicy := clientTrafficPolicy
key := utils.NamespacedName(clientTrafficPolicy)
if !(reflect.ValueOf(clientTrafficPolicy.Status).IsZero()) {
r.ProviderResources.ClientTrafficPolicyStatuses.Store(key, &clientTrafficPolicy.Status)
}
delete(statusesToDelete.ClientTrafficPolicyStatusKeys, key)
}
for _, backendTrafficPolicy := range result.BackendTrafficPolicies {
backendTrafficPolicy := backendTrafficPolicy
key := utils.NamespacedName(backendTrafficPolicy)
if !(reflect.ValueOf(backendTrafficPolicy.Status).IsZero()) {
r.ProviderResources.BackendTrafficPolicyStatuses.Store(key, &backendTrafficPolicy.Status)
}
delete(statusesToDelete.BackendTrafficPolicyStatusKeys, key)
}
for _, securityPolicy := range result.SecurityPolicies {
securityPolicy := securityPolicy
key := utils.NamespacedName(securityPolicy)
if !(reflect.ValueOf(securityPolicy.Status).IsZero()) {
r.ProviderResources.SecurityPolicyStatuses.Store(key, &securityPolicy.Status)
Expand Down

0 comments on commit b608831

Please sign in to comment.