fix-up gosimple check error

This commit is contained in:
tanjunchen 2019-10-07 11:59:57 +08:00
parent 21240d9da4
commit 43bf6bdab6
11 changed files with 15 additions and 45 deletions

View File

@ -260,9 +260,7 @@ func (m *MockEC2) AuthorizeSecurityGroupEgress(request *ec2.AuthorizeSecurityGro
sg.IpPermissionsEgress = append(sg.IpPermissionsEgress, p) sg.IpPermissionsEgress = append(sg.IpPermissionsEgress, p)
} }
for _, p := range request.IpPermissions { sg.IpPermissionsEgress = append(sg.IpPermissionsEgress, request.IpPermissions...)
sg.IpPermissionsEgress = append(sg.IpPermissionsEgress, p)
}
// TODO: We need to fold permissions // TODO: We need to fold permissions
@ -318,9 +316,7 @@ func (m *MockEC2) AuthorizeSecurityGroupIngress(request *ec2.AuthorizeSecurityGr
sg.IpPermissions = append(sg.IpPermissions, p) sg.IpPermissions = append(sg.IpPermissions, p)
} }
for _, p := range request.IpPermissions { sg.IpPermissions = append(sg.IpPermissions, request.IpPermissions...)
sg.IpPermissions = append(sg.IpPermissions, p)
}
// TODO: We need to fold permissions // TODO: We need to fold permissions

View File

@ -60,9 +60,7 @@ func (r *Route53APIStub) ListResourceRecordSetsPages(input *route53.ListResource
output.ResourceRecordSets = []*route53.ResourceRecordSet{} output.ResourceRecordSets = []*route53.ResourceRecordSet{}
} else { } else {
for _, rrsets := range r.recordSets[*input.HostedZoneId] { for _, rrsets := range r.recordSets[*input.HostedZoneId] {
for _, rrset := range rrsets { output.ResourceRecordSets = append(output.ResourceRecordSets, rrsets...)
output.ResourceRecordSets = append(output.ResourceRecordSets, rrset)
}
} }
} }
lastPage := true lastPage := true

View File

@ -144,9 +144,7 @@ func run() error {
} }
} }
for _, p := range result.PriceList { prices = append(prices, result.PriceList...)
prices = append(prices, p)
}
if result.NextToken != nil { if result.NextToken != nil {
input.NextToken = result.NextToken input.NextToken = result.NextToken

View File

@ -545,9 +545,7 @@ func (b *KubeletBuilder) buildKubeletConfigSpec() (*kops.KubeletConfigSpec, erro
// Use --register-with-taints for k8s 1.6 and on // Use --register-with-taints for k8s 1.6 and on
if b.Cluster.IsKubernetesGTE("1.6") { if b.Cluster.IsKubernetesGTE("1.6") {
for _, t := range b.InstanceGroup.Spec.Taints { c.Taints = append(c.Taints, b.InstanceGroup.Spec.Taints...)
c.Taints = append(c.Taints, t)
}
if len(c.Taints) == 0 && isMaster { if len(c.Taints) == 0 && isMaster {
// (Even though the value is empty, we still expect <Key>=<Value>:<Effect>) // (Even though the value is empty, we still expect <Key>=<Value>:<Effect>)

View File

@ -310,9 +310,7 @@ func (b *AutoscalingGroupModelBuilder) buildAutoScalingGroupTask(c *fi.ModelBuil
t.Tags = tags t.Tags = tags
processes := []string{} processes := []string{}
for _, p := range ig.Spec.SuspendProcesses { processes = append(processes, ig.Spec.SuspendProcesses...)
processes = append(processes, p)
}
t.SuspendProcesses = &processes t.SuspendProcesses = &processes
t.InstanceProtection = ig.Spec.InstanceProtection t.InstanceProtection = ig.Spec.InstanceProtection

View File

@ -327,9 +327,7 @@ func (d *clusterDiscoveryALI) ListSecurityGroup() ([]*resources.Resource, error)
} }
} }
for _, block := range blocked { groupTracker.Blocked = append(groupTracker.Blocked, blocked...)
groupTracker.Blocked = append(groupTracker.Blocked, block)
}
resourceTrackers = append(resourceTrackers, groupTracker) resourceTrackers = append(resourceTrackers, groupTracker)
} }
} }
@ -558,9 +556,7 @@ func (d *clusterDiscoveryALI) ListVPC() ([]*resources.Resource, error) {
for _, vpc := range vpcs { for _, vpc := range vpcs {
if name == vpc.VpcName { if name == vpc.VpcName {
vpcsToDelete = append(vpcsToDelete, vpc.VpcId) vpcsToDelete = append(vpcsToDelete, vpc.VpcId)
for _, vswitch := range vpc.VSwitchIds.VSwitchId { vswitchsToDelete = append(vswitchsToDelete, vpc.VSwitchIds.VSwitchId...)
vswitchsToDelete = append(vswitchsToDelete, vswitch)
}
} }
} }
} }

View File

@ -258,9 +258,7 @@ func FindAutoscalingLaunchConfiguration(cloud awsup.AWSCloud, name string) (*aut
LaunchConfigurationNames: []*string{&name}, LaunchConfigurationNames: []*string{&name},
} }
err := cloud.Autoscaling().DescribeLaunchConfigurationsPages(request, func(p *autoscaling.DescribeLaunchConfigurationsOutput, lastPage bool) bool { err := cloud.Autoscaling().DescribeLaunchConfigurationsPages(request, func(p *autoscaling.DescribeLaunchConfigurationsOutput, lastPage bool) bool {
for _, t := range p.LaunchConfigurations { results = append(results, p.LaunchConfigurations...)
results = append(results, t)
}
return true return true
}) })
if err != nil { if err != nil {
@ -1094,9 +1092,7 @@ func DescribeInternetGateways(cloud fi.Cloud) ([]*ec2.InternetGateway, error) {
} }
var gateways []*ec2.InternetGateway var gateways []*ec2.InternetGateway
for _, o := range response.InternetGateways { gateways = append(gateways, response.InternetGateways...)
gateways = append(gateways, o)
}
return gateways, nil return gateways, nil
} }
@ -1116,9 +1112,7 @@ func DescribeInternetGatewaysIgnoreTags(cloud fi.Cloud) ([]*ec2.InternetGateway,
var gateways []*ec2.InternetGateway var gateways []*ec2.InternetGateway
for _, igw := range response.InternetGateways { gateways = append(gateways, response.InternetGateways...)
gateways = append(gateways, igw)
}
return gateways, nil return gateways, nil
} }

View File

@ -40,9 +40,7 @@ func DeleteResources(cloud fi.Cloud, resourceMap map[string]*resources.Resource)
depMap[block] = append(depMap[block], k) depMap[block] = append(depMap[block], k)
} }
for _, blocked := range t.Blocked { depMap[k] = append(depMap[k], t.Blocked...)
depMap[k] = append(depMap[k], blocked)
}
if t.Done { if t.Done {
done[k] = t done[k] = t

View File

@ -33,9 +33,7 @@ func (p *GossipDnsProvider) Replace(fqdn string, values []string) error {
Name: fqdn, Name: fqdn,
RrsType: "A", RrsType: "A",
} }
for _, value := range values { record.Rrdatas = append(record.Rrdatas, values...)
record.Rrdatas = append(record.Rrdatas, value)
}
return p.DNSView.ApplyChangeset(p.Zone, nil, []*dns.DNSRecord{record}) return p.DNSView.ApplyChangeset(p.Zone, nil, []*dns.DNSRecord{record})
} }

View File

@ -73,9 +73,7 @@ func (e *Instance) Find(c *fi.Context) (*Instance, error) {
actual := &Instance{} actual := &Instance{}
actual.Name = &r.Name actual.Name = &r.Name
for _, tag := range r.Tags.Items { actual.Tags = append(actual.Tags, r.Tags.Items...)
actual.Tags = append(actual.Tags, tag)
}
actual.Zone = fi.String(lastComponent(r.Zone)) actual.Zone = fi.String(lastComponent(r.Zone))
actual.MachineType = fi.String(lastComponent(r.MachineType)) actual.MachineType = fi.String(lastComponent(r.MachineType))
actual.CanIPForward = &r.CanIpForward actual.CanIPForward = &r.CanIpForward

View File

@ -103,9 +103,7 @@ func (e *InstanceTemplate) Find(c *fi.Context) (*InstanceTemplate, error) {
p := r.Properties p := r.Properties
for _, tag := range p.Tags.Items { actual.Tags = append(actual.Tags, p.Tags.Items...)
actual.Tags = append(actual.Tags, tag)
}
actual.MachineType = fi.String(lastComponent(p.MachineType)) actual.MachineType = fi.String(lastComponent(p.MachineType))
actual.CanIPForward = &p.CanIpForward actual.CanIPForward = &p.CanIpForward