Skip to content

Commit ea230d9

Browse files
committed
chore: re-enable printf go vet
1 parent a44d08f commit ea230d9

File tree

10 files changed

+16
-19
lines changed

10 files changed

+16
-19
lines changed

cluster-autoscaler/Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
ALL_ARCH = amd64 arm64 s390x
22
all: $(addprefix build-arch-,$(ALL_ARCH))
33

4-
# TODO: #8127 - Use default analyzers set by `go test` to include `printf` analyzer.
5-
# Default analyzers that go test runs according to https://github.com/golang/go/blob/52624e533fe52329da5ba6ebb9c37712048168e0/src/cmd/go/internal/test/test.go#L649
6-
# This doesn't include the `printf` analyzer until cluster-autoscaler libraries are updated.
7-
GO_TEST_DEFAULT_ANALYZERS?=atomic,bool,buildtags,directive,errorsas,ifaceassert,nilfunc,slog,stringintconv,tests
4+
GO_TEST_DEFAULT_ANALYZERS?=atomic,bool,buildtags,directive,errorsas,ifaceassert,nilfunc,slog,stringintconv,tests,printf
85
TAG?=dev
96
FLAGS=
107
LDFLAGS?=-s
@@ -58,7 +55,7 @@ test-build-tags:
5855
done
5956

6057
test-unit: clean build
61-
go test --test.short -race ./... -vet="${GO_TEST_DEFAULT_ANALYZERS}" ${TAGS_FLAG}
58+
go test --test.short -race $$(go list ./... | grep -v vendor | grep -v aws-sdk-go) -vet="${GO_TEST_DEFAULT_ANALYZERS}" ${TAGS_FLAG}
6259

6360
dev-release: dev-release-arch-$(GOARCH)
6461

cluster-autoscaler/cloudprovider/aws/auto_scaling_groups.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ func (m *asgCache) DeleteInstances(instances []*AwsInstanceRef) error {
375375
if err != nil {
376376
return err
377377
}
378-
klog.V(4).Infof(*resp.Activity.Description)
378+
klog.V(4).Infof("%s", *resp.Activity.Description)
379379

380380
// Proactively decrement the size so autoscaler makes better decisions
381381
commonAsg.curSize--

cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/session/shared_config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ func (cfg *sharedConfig) setFromIniFiles(profiles map[string]struct{}, profile s
349349
if cfg.hasSSOTokenProviderConfiguration() {
350350
skippedFiles = 0
351351
for _, f := range files {
352-
section, ok := f.IniData.GetSection(fmt.Sprintf(ssoSectionPrefix + strings.TrimSpace(cfg.SSOSessionName)))
352+
section, ok := f.IniData.GetSection(ssoSectionPrefix + strings.TrimSpace(cfg.SSOSessionName))
353353
if ok {
354354
var ssoSession ssoSession
355355
ssoSession.setFromIniSection(section)

cluster-autoscaler/cloudprovider/azure/azure_util.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,15 @@ func normalizeForK8sVMASScalingUp(templateMap map[string]interface{}) error {
259259
if ok && resourceType == nsgResourceType {
260260
if nsgIndex != -1 {
261261
err := fmt.Errorf("found 2 resources with type %s in the template. There should only be 1", nsgResourceType)
262-
klog.Errorf(err.Error())
262+
klog.Errorf("%s", err.Error())
263263
return err
264264
}
265265
nsgIndex = index
266266
}
267267
if ok && resourceType == rtResourceType {
268268
if rtIndex != -1 {
269269
err := fmt.Errorf("found 2 resources with type %s in the template. There should only be 1", rtResourceType)
270-
klog.Warningf(err.Error())
270+
klog.Warningf("%s", err.Error())
271271
return err
272272
}
273273
rtIndex = index
@@ -296,7 +296,7 @@ func normalizeForK8sVMASScalingUp(templateMap map[string]interface{}) error {
296296
indexesToRemove := []int{}
297297
if nsgIndex == -1 {
298298
err := fmt.Errorf("found no resources with type %s in the template. There should have been 1", nsgResourceType)
299-
klog.Errorf(err.Error())
299+
klog.Errorf("%s", err.Error())
300300
return err
301301
}
302302
if rtIndex == -1 {

cluster-autoscaler/cloudprovider/baiducloud/baiducloud-sdk-go/util/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ func Debug(title, message string) {
566566
klog.V(5).Infof("----------------------------DEBUG: start of %s ----------------------------", title)
567567
}
568568

569-
klog.V(5).Infof(message)
569+
klog.V(5).Infof("%s", message)
570570

571571
if title != "" {
572572
klog.V(5).Infof("----------------------------DEBUG: end of %s------------------------------", title)

cluster-autoscaler/cloudprovider/civo/civo-cloud-sdk-go/errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ func decodeError(err error) error {
10721072
err := errors.New(msg.String())
10731073
return KubernetesClusterInvalidNameError.wrap(err)
10741074
default:
1075-
err := fmt.Errorf(fmt.Sprintf("Unknown error response - status: %s, code: %d, reason: %s", errorData.Status, errorData.Code, errorData.Reason))
1075+
err := fmt.Errorf("Unknown error response - status: %s, code: %d, reason: %s", errorData.Status, errorData.Code, errorData.Reason)
10761076
return CommonError.wrap(err)
10771077
}
10781078
}

cluster-autoscaler/cloudprovider/huaweicloud/huaweicloud-sdk-go-v3/core/sdkerr/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,5 +133,5 @@ func (sr ServiceResponseError) Error() string {
133133
if err != nil {
134134
return fmt.Sprintf("{\"ErrorMessage\": \"%s\",\"ErrorCode\": \"%s\"}", sr.ErrorMessage, sr.ErrorCode)
135135
}
136-
return fmt.Sprintf(string(data))
136+
return string(data)
137137
}

cluster-autoscaler/cloudprovider/oci/instancepools/oci_instance_pool_cache.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func (c *instancePoolCache) findInstanceByDetails(ociInstance ocicommon.OciRef)
213213

214214
if c.unownedInstances[ociInstance] {
215215
// We already know this instance is not part of a configured pool. Return early and avoid additional API calls.
216-
klog.V(4).Infof("Node " + ociInstance.Name + " is known to not be a member of any of the specified instance pool(s)")
216+
klog.V(4).Infof("Node %s is known to not be a member of any of the specified instance pool(s)", ociInstance.Name)
217217
return nil, errInstanceInstancePoolNotFound
218218
}
219219

@@ -307,7 +307,7 @@ func (c *instancePoolCache) findInstanceByDetails(ociInstance ocicommon.OciRef)
307307
}
308308

309309
c.unownedInstances[ociInstance] = true
310-
klog.V(4).Infof(ociInstance.Name + " is not a member of any of the specified instance pool(s)")
310+
klog.V(4).Infof("%s is not a member of any of the specified instance pool(s)", ociInstance.Name)
311311
return nil, errInstanceInstancePoolNotFound
312312
}
313313

cluster-autoscaler/cloudprovider/oci/instancepools/oci_instance_pool_manager.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ package instancepools
66

77
import (
88
"fmt"
9-
npconsts "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/oci/nodepools/consts"
109
"os"
1110
"strconv"
1211
"strings"
1312
"time"
1413

14+
npconsts "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/oci/nodepools/consts"
15+
1516
ocicommon "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/oci/common"
1617
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/oci/instancepools/consts"
1718

@@ -310,8 +311,7 @@ func (m *InstancePoolManagerImpl) GetInstancePoolNodes(ip InstancePoolNodeGroup)
310311
func (m *InstancePoolManagerImpl) GetInstancePoolForInstance(instanceDetails ocicommon.OciRef) (*InstancePoolNodeGroup, error) {
311312
if m.cfg.Global.UseNonMemberAnnotation && instanceDetails.InstancePoolID == consts.OciInstancePoolIDNonPoolMember {
312313
// Instance is not part of a configured pool. Return early and avoid additional API calls.
313-
klog.V(4).Infof(instanceDetails.Name + " is not a member of any of the specified instance pool(s) and already annotated as " +
314-
consts.OciInstancePoolIDNonPoolMember)
314+
klog.V(4).Infof("%s is not a member of any of the specified instance pool(s) and already annotated as %s", instanceDetails.Name, consts.OciInstancePoolIDNonPoolMember)
315315
return nil, errInstanceInstancePoolNotFound
316316
}
317317

cluster-autoscaler/cloudprovider/volcengine/volcengine-go-sdk/volcengine/credentials/sts_provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (s *StsProvider) Retrieve() (Value, error) {
6262
if _err != nil {
6363
return Value{}, _err
6464
}
65-
return Value{}, fmt.Errorf(string(bb))
65+
return Value{}, fmt.Errorf("%s", string(bb))
6666
}
6767
return Value{}, err
6868
}

0 commit comments

Comments
 (0)