Merge pull request #7819 from hwdef/fix-static-check1

pkg: fix static check
This commit is contained in:
Kubernetes Prow Robot 2019-10-24 22:37:39 -07:00 committed by GitHub
commit 2fa12d3dd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 9 additions and 19 deletions

View File

@ -98,7 +98,7 @@ func ValidateInstanceGroup(g *kops.InstanceGroup) error {
// @step: iterate and check the volume specs
for i, x := range g.Spec.Volumes {
devices := make(map[string]bool, 0)
devices := make(map[string]bool)
path := field.NewPath("volumes").Index(i)
if err := validateVolumeSpec(path, x); err != nil {
@ -115,7 +115,7 @@ func ValidateInstanceGroup(g *kops.InstanceGroup) error {
// @step: iterate and check the volume mount specs
for i, x := range g.Spec.VolumeMounts {
used := make(map[string]bool, 0)
used := make(map[string]bool)
path := field.NewPath("volumeMounts").Index(i)
if err := validateVolumeMountSpec(path, x); err != nil {

View File

@ -21,8 +21,5 @@ import "strings"
// TODO: Are .local names necessarily invalid for "real DNS"? Do we need more qualification here?
func IsGossipHostname(name string) bool {
normalized := "." + strings.TrimSuffix(name, ".")
if strings.HasSuffix(normalized, ".k8s.local") {
return true
}
return false
return strings.HasSuffix(normalized, ".k8s.local")
}

View File

@ -62,10 +62,7 @@ func NewCordonHelperFromRuntimeObject(nodeObject runtime.Object, scheme *runtime
// or false when no change is needed
func (c *CordonHelper) UpdateIfRequired(desired bool) bool {
c.desired = desired
if c.node.Spec.Unschedulable == c.desired {
return false
}
return true
return c.node.Spec.Unschedulable != c.desired
}
// PatchOrReplace uses given clientset to update the node status, either by patching or

View File

@ -181,7 +181,7 @@ func (b *BootstrapScript) ResourceNodeUp(ig *kops.InstanceGroup, cluster *kops.C
if ig.IsMaster() {
spec["encryptionConfig"] = cs.EncryptionConfig
spec["etcdClusters"] = make(map[string]kops.EtcdClusterSpec, 0)
spec["etcdClusters"] = make(map[string]kops.EtcdClusterSpec)
spec["kubeAPIServer"] = cs.KubeAPIServer
spec["kubeControllerManager"] = cs.KubeControllerManager
spec["kubeScheduler"] = cs.KubeScheduler

View File

@ -170,7 +170,7 @@ func (b *AutoscalingGroupModelBuilder) Build(c *fi.ModelBuilderContext) error {
// 1) no support in terraform
// 2) we can't steer to specific zones AFAICT, only to all zones in the region
targetSizes := make([]int, len(zones), len(zones))
targetSizes := make([]int, len(zones))
totalSize := 0
for i := range zones {
targetSizes[i] = minSize / len(zones)

View File

@ -159,29 +159,24 @@ func (b *InstanceGroupModelBuilder) buildElastigroup(c *fi.ModelBuilderContext,
if err != nil {
return err
}
break
case InstanceGroupLabelOrientation:
group.Orientation = fi.String(v)
break
case InstanceGroupLabelUtilizeReservedInstances:
group.UtilizeReservedInstances, err = parseBool(v)
if err != nil {
return err
}
break
case InstanceGroupLabelFallbackToOnDemand:
group.FallbackToOnDemand, err = parseBool(v)
if err != nil {
return err
}
break
case InstanceGroupLabelHealthCheckType:
group.HealthCheckType = fi.String(strings.ToUpper(v))
break
}
}

View File

@ -17,6 +17,7 @@ limitations under the License.
package digitalocean
import (
"context"
"errors"
"fmt"
"os"
@ -70,7 +71,7 @@ func NewCloud(region string) (*Cloud, error) {
AccessToken: accessToken,
}
oauthClient := oauth2.NewClient(oauth2.NoContext, tokenSource)
oauthClient := oauth2.NewClient(context.TODO(), tokenSource)
client := godo.NewClient(oauthClient)
return &Cloud{

View File

@ -72,7 +72,7 @@ func newClient() (*godo.Client, error) {
AccessToken: accessToken,
}
oauthClient := oauth2.NewClient(oauth2.NoContext, tokenSource)
oauthClient := oauth2.NewClient(context.TODO(), tokenSource)
return godo.NewClient(oauthClient), nil
}