From 295fb11ac24404f18a2b33f5c576553ddb4265ab Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Wed, 10 Feb 2021 09:39:32 +0100 Subject: [PATCH] Better readable modification assigning of PrivateIPv4Address --- pkg/model/awsmodel/api_loadbalancer.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/model/awsmodel/api_loadbalancer.go b/pkg/model/awsmodel/api_loadbalancer.go index f199eb948b..ad95969f6b 100644 --- a/pkg/model/awsmodel/api_loadbalancer.go +++ b/pkg/model/awsmodel/api_loadbalancer.go @@ -72,12 +72,14 @@ func (b *APILoadBalancerBuilder) Build(c *fi.ModelBuilderContext) error { if subnet.Name == clusterSubnet.Name { elbSubnet := b.LinkToSubnet(&clusterSubnet) elbSubnets = append(elbSubnets, elbSubnet) - nlbSubnetMappings = append(nlbSubnetMappings, &awstasks.SubnetMapping{ + + nlbSubnetMapping := &awstasks.SubnetMapping{ Subnet: elbSubnet, - }) - if subnet.PrivateIPv4Address != nil { - nlbSubnetMappings[len(nlbSubnetMappings)-1].PrivateIPv4Address = subnet.PrivateIPv4Address } + if subnet.PrivateIPv4Address != nil { + nlbSubnetMapping.PrivateIPv4Address = subnet.PrivateIPv4Address + } + nlbSubnetMappings = append(nlbSubnetMappings, nlbSubnetMapping) break } }