Skip to content

Commit

Permalink
Merge pull request #712 from zalando-incubator/all/fix-golint
Browse files Browse the repository at this point in the history
all: fix golangci-lint errors
  • Loading branch information
AlexanderYastrebov authored Nov 29, 2023
2 parents 237df95 + 7582e78 commit ddc8570
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
3 changes: 1 addition & 2 deletions controller/cluster_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ func (clusterList *ClusterList) UpdateAvailable(configSource channel.ConfigSourc
return true
} else if pi < pj {
return false
} else {
return pendingUpdate[i].lastProcessed.Before(pendingUpdate[j].lastProcessed)
}
return pendingUpdate[i].lastProcessed.Before(pendingUpdate[j].lastProcessed)
})
clusterList.pendingUpdate = pendingUpdate
}
Expand Down
45 changes: 22 additions & 23 deletions pkg/aws/instance_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,34 +124,33 @@ func (types *InstanceTypes) SyntheticInstanceInfo(instanceTypes []string) (Insta
return Instance{}, fmt.Errorf("no instance types provided")
} else if len(instanceTypes) == 1 {
return types.InstanceInfo(instanceTypes[0])
} else {
first, err := types.InstanceInfo(instanceTypes[0])
}

first, err := types.InstanceInfo(instanceTypes[0])
if err != nil {
return Instance{}, err
}

result := Instance{
InstanceType: "<multiple>",
VCPU: first.VCPU,
Memory: first.Memory,
InstanceStorageDevices: first.InstanceStorageDevices,
InstanceStorageDeviceSize: first.InstanceStorageDeviceSize,
Architecture: first.Architecture,
}
for _, instanceType := range instanceTypes[1:] {
info, err := types.InstanceInfo(instanceType)
if err != nil {
return Instance{}, err
}

result := Instance{
InstanceType: first.InstanceType,
VCPU: first.VCPU,
Memory: first.Memory,
InstanceStorageDevices: first.InstanceStorageDevices,
InstanceStorageDeviceSize: first.InstanceStorageDeviceSize,
Architecture: first.Architecture,
}
for _, instanceType := range instanceTypes[1:] {
info, err := types.InstanceInfo(instanceType)
if err != nil {
return Instance{}, err
}

result.VCPU = min(result.VCPU, info.VCPU)
result.Memory = min(result.Memory, info.Memory)
result.InstanceStorageDeviceSize = min(result.InstanceStorageDeviceSize, info.InstanceStorageDeviceSize)
result.InstanceStorageDevices = min(result.InstanceStorageDevices, info.InstanceStorageDevices)
}
result.InstanceType = "<multiple>"
return result, nil
result.VCPU = min(result.VCPU, info.VCPU)
result.Memory = min(result.Memory, info.Memory)
result.InstanceStorageDeviceSize = min(result.InstanceStorageDeviceSize, info.InstanceStorageDeviceSize)
result.InstanceStorageDevices = min(result.InstanceStorageDevices, info.InstanceStorageDevices)
}
return result, nil
}

// getCompatibleCPUArchitecture returns a single compatible CPU architecture. It's either `amd64` or `arm64`.
Expand Down

0 comments on commit ddc8570

Please sign in to comment.