Skip to content

Commit

Permalink
cleanup code to cancel some staticcheck warnings
Browse files Browse the repository at this point in the history
correct versionWithoutV without re-assign to variable

Signed-off-by: Guangming Wang <[email protected]>
  • Loading branch information
Guangming Wang committed Sep 25, 2019
1 parent 89feb2d commit 9450913
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
8 changes: 2 additions & 6 deletions upup/pkg/fi/cloudup/apply_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,7 @@ func (c *ApplyClusterCmd) Run() error {

// Normalize k8s version
versionWithoutV := strings.TrimSpace(cluster.Spec.KubernetesVersion)
if strings.HasPrefix(versionWithoutV, "v") {
versionWithoutV = versionWithoutV[1:]
}
versionWithoutV = strings.TrimPrefix(versionWithoutV, "v")
if cluster.Spec.KubernetesVersion != versionWithoutV {
klog.Warningf("Normalizing kubernetes version: %q -> %q", cluster.Spec.KubernetesVersion, versionWithoutV)
cluster.Spec.KubernetesVersion = versionWithoutV
Expand Down Expand Up @@ -1271,9 +1269,7 @@ func (c *ApplyClusterCmd) BuildNodeUpConfig(assetBuilder *assets.AssetBuilder, i
}

config := &nodeup.Config{}
for _, tag := range nodeUpTags.List() {
config.Tags = append(config.Tags, tag)
}
config.Tags = append(config.Tags, nodeUpTags.List()...)

for _, a := range c.Assets {
config.Assets = append(config.Assets, a.CompactString())
Expand Down
4 changes: 1 addition & 3 deletions upup/pkg/fi/cloudup/awstasks/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ func (e *Instance) Find(c *fi.Context) (*Instance, error) {
instances := []*ec2.Instance{}
if response != nil {
for _, reservation := range response.Reservations {
for _, instance := range reservation.Instances {
instances = append(instances, instance)
}
instances = append(instances, reservation.Instances...)
}
}

Expand Down

0 comments on commit 9450913

Please sign in to comment.