Skip to content

Commit

Permalink
chore: lint: fix further
Browse files Browse the repository at this point in the history
  • Loading branch information
tasdikrahman committed Jun 28, 2024
1 parent 9cf08e6 commit 663def9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions cloud/scope/machinepool_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package scope_test

import (
"fmt"
"testing"

. "github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -58,7 +57,7 @@ var _ = Describe("GCPManagedMachinePool Scope", func() {
Context("instance types", func() {
It("should match all", func() {
for k := range processors.Processors {
TestMachinePoolScope.GCPMachinePool.Spec.InstanceType = fmt.Sprintf("%sstandard-8", k)
TestMachinePoolScope.GCPMachinePool.Spec.InstanceType = k + "standard-8"
Expect(TestMachinePoolScope.MinCPUPlatform()).To(Equal(processors.Processors[k]))
}
})
Expand Down
4 changes: 2 additions & 2 deletions cloud/scope/machinepoolmachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ func (m *MachinePoolMachineScope) ProviderID() string {
func (m *MachinePoolMachineScope) HasLatestModelApplied(ctx context.Context, instance *compute.Disk, labels map[string]string) (bool, error) {
log := log.FromContext(ctx)

image := ""
var image string

if m.GCPMachinePool.Spec.Image == nil {
version := ""
Expand Down Expand Up @@ -351,7 +351,7 @@ func (m *MachinePoolMachineScope) doesNotHaveAdditionalLabelsDiff(ctx context.Co
}
}
_, hasCapgRoleKey := diff["capg-role"]
_, hasCapgClusterKey := diff[fmt.Sprintf("capg-cluster-%s", m.GCPMachinePool.ObjectMeta.Labels["cluster.x-k8s.io/cluster-name"])]
_, hasCapgClusterKey := diff["capg-cluster-"+m.GCPMachinePool.ObjectMeta.Labels["cluster.x-k8s.io/cluster-name"]]
if hasCapgRoleKey && hasCapgClusterKey && len(diff) == 2 {
log.Info("There's no diff in AdditionalLabels which are present.", "GCPMachinePoolMachine", m.GCPMachinePoolMachine)
return false
Expand Down
1 change: 1 addition & 0 deletions cloud/services/compute/instancegroups/instancegroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ func (s *Service) removeOldInstanceTemplate(ctx context.Context, instanceTemplat
// Prepare to identify instance templates to remove.
lastIndex := strings.LastIndex(instanceTemplateName, "-")
if lastIndex == -1 {
//nolint
log.Error(fmt.Errorf("invalid instance template name format"), "Invalid template name", "templateName", instanceTemplateName)
return fmt.Errorf("invalid instance template name format: %s", instanceTemplateName)
}
Expand Down

0 comments on commit 663def9

Please sign in to comment.