Skip to content

Commit

Permalink
Address perfsprint linter violations
Browse files Browse the repository at this point in the history
"fmt.Sprintf can be replaced with string concatenation"

Signed-off-by: Tom Pantelis <[email protected]>
  • Loading branch information
tpantelis committed Dec 4, 2024
1 parent b1060b4 commit 907b4d3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
3 changes: 1 addition & 2 deletions pkg/aws/ec2helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ limitations under the License.
package aws

import (
"fmt"
"strings"

"github.com/aws/aws-sdk-go-v2/service/ec2/types"
Expand All @@ -41,7 +40,7 @@ func ec2Tag(key, value string) types.Tag {
}

func ec2FilterByTag(tag types.Tag) types.Filter {
return ec2Filter(fmt.Sprintf("tag:%s", *tag.Key), *tag.Value)
return ec2Filter("tag:"+*tag.Key, *tag.Value)
}

func hasTag(tags []types.Tag, desired types.Tag) bool {
Expand Down
2 changes: 1 addition & 1 deletion pkg/aws/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type notFoundError struct {
}

func (e notFoundError) Error() string {
return fmt.Sprintf("%s not found", e.s)
return e.s + " not found"
}

func newNotFoundError(msg string, args ...interface{}) error {
Expand Down
7 changes: 3 additions & 4 deletions pkg/aws/securitygroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package aws

import (
"context"
"fmt"
"strings"
"time"

Expand Down Expand Up @@ -145,19 +144,19 @@ func (ac *awsCloud) allowPortInCluster(vpcID string, port uint16, protocol strin
}
}

err = ac.createClusterSGRule(workerGroupID, workerGroupID, port, protocol, fmt.Sprintf("%s between the workers", internalTraffic))
err = ac.createClusterSGRule(workerGroupID, workerGroupID, port, protocol, internalTraffic+" between the workers")
if err != nil {
return err
}

err = ac.createClusterSGRule(workerGroupID, controlPlaneGroupID, port, protocol,
fmt.Sprintf("%s from worker to control plane nodes", internalTraffic))
internalTraffic+" from worker to control plane nodes")
if err != nil {
return err
}

return ac.createClusterSGRule(controlPlaneGroupID, workerGroupID, port, protocol,
fmt.Sprintf("%s from control plane to worker nodes", internalTraffic))
internalTraffic+" from control plane to worker nodes")
}

func (ac *awsCloud) createPublicSGRule(groupID *string, port uint16, protocol, description string) error {
Expand Down
8 changes: 4 additions & 4 deletions pkg/gcp/firewall_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ func newInternalFirewallRule(projectID, infraID string, ports []api.PortSpec) *c

rule := newFirewallRule(projectID, infraID, ingressName, ingressDirection, ports)
rule.TargetTags = []string{
fmt.Sprintf("%s-worker", infraID),
fmt.Sprintf("%s-master", infraID),
infraID + "-worker",
infraID + "-master",
}
rule.SourceTags = []string{
fmt.Sprintf("%s-worker", infraID),
fmt.Sprintf("%s-master", infraID),
infraID + "-worker",
infraID + "-master",
}

return rule
Expand Down

0 comments on commit 907b4d3

Please sign in to comment.