From ffca92e42a52a1667046f08b56fdb404df76d229 Mon Sep 17 00:00:00 2001 From: barbacbd Date: Mon, 1 Dec 2025 14:07:07 -0500 Subject: [PATCH 1/3] no-jira: Fix linting issues for golangci-lint v2 pkg/agent/logging.go: QF1006: could lift into loop condition Skip lint check. pkg/asset/manifests/azure/cluster.go: QF1003: could use tagged switch on subnetType Use a switch instead of if-else pkg/infrastructure/azure/storage.go: QF1007: could merge conditional assignment into variable declaration pkg/infrastructure/baremetal/image.go: QF1009: probably want to use time.Time.Equal instead Use function for time.Equal rather than ==. --- pkg/agent/logging.go | 2 +- pkg/asset/manifests/azure/cluster.go | 5 +++-- pkg/infrastructure/azure/storage.go | 5 +---- pkg/infrastructure/baremetal/image.go | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/pkg/agent/logging.go b/pkg/agent/logging.go index 6cb78ceec15..6b8ae42f008 100644 --- a/pkg/agent/logging.go +++ b/pkg/agent/logging.go @@ -64,7 +64,7 @@ func printChannelLogs(ip string, ch chan logEntry) { func printLogs(wg *sync.WaitGroup, ipChanMap map[string]chan logEntry) { defer wg.Done() for { - if len(ipChanMap) == 0 { + if len(ipChanMap) == 0 { //nolint: staticcheck // no IPs to monitor or all channels are closed, exit loop break } diff --git a/pkg/asset/manifests/azure/cluster.go b/pkg/asset/manifests/azure/cluster.go index 399cc746d9c..cc1c2c18c15 100644 --- a/pkg/asset/manifests/azure/cluster.go +++ b/pkg/asset/manifests/azure/cluster.go @@ -495,13 +495,14 @@ func getSubnet(installConfig *installconfig.InstallConfig, subnetType capz.Subne } ctx := context.TODO() - if subnetType == capz.SubnetControlPlane { + switch subnetType { + case capz.SubnetControlPlane: subnet, err = azClient.GetControlPlaneSubnet(ctx, installConfig.Config.Azure.NetworkResourceGroupName, installConfig.Config.Azure.VirtualNetwork, subnetName, ) - } else if subnetType == capz.SubnetNode { + case capz.SubnetNode: subnet, err = azClient.GetComputeSubnet(ctx, installConfig.Config.Azure.NetworkResourceGroupName, installConfig.Config.Azure.VirtualNetwork, diff --git a/pkg/infrastructure/azure/storage.go b/pkg/infrastructure/azure/storage.go index 3f048ebeeb8..68b5d8b6111 100644 --- a/pkg/infrastructure/azure/storage.go +++ b/pkg/infrastructure/azure/storage.go @@ -81,10 +81,7 @@ func CreateStorageAccount(ctx context.Context, in *CreateStorageAccountInput) (* //APIVersion: "2019-06-01", }, } - allowSharedKeyAccess := true - if in.AuthType == azic.ManagedIdentityAuth { - allowSharedKeyAccess = false - } + allowSharedKeyAccess := in.AuthType != azic.ManagedIdentityAuth storageClientFactory, err := armstorage.NewClientFactory(in.SubscriptionID, in.TokenCredential, opts) if err != nil { diff --git a/pkg/infrastructure/baremetal/image.go b/pkg/infrastructure/baremetal/image.go index 3c13146c611..09e9a7aa1e3 100644 --- a/pkg/infrastructure/baremetal/image.go +++ b/pkg/infrastructure/baremetal/image.go @@ -77,7 +77,7 @@ func (i *localImage) Import(copier func(io.Reader) error, vol libvirtxml.Storage } // we can skip the upload if the modification times are the same if vol.Target.Timestamps != nil && vol.Target.Timestamps.Mtime != "" { - if fi.ModTime() == timeFromEpoch(vol.Target.Timestamps.Mtime) { + if fi.ModTime().Equal(timeFromEpoch(vol.Target.Timestamps.Mtime)) { logrus.Info("Modification time is the same: skipping image copy") return nil } From 85acb4d49e897bcc6216034e57d03b3955e40dc2 Mon Sep 17 00:00:00 2001 From: barbacbd Date: Tue, 2 Dec 2025 11:50:47 -0500 Subject: [PATCH 2/3] Added golangci config option for min-complexity on gocyclo --- .golangci-lint-v2.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.golangci-lint-v2.yaml b/.golangci-lint-v2.yaml index b2e69e9735b..7b4879a32dc 100644 --- a/.golangci-lint-v2.yaml +++ b/.golangci-lint-v2.yaml @@ -42,6 +42,8 @@ linters: gosec: excludes: - G115 + gocyclo: + min-complexity: 45 staticcheck: checks: # Default From 1a338cf72958cb8a9d2ed4c055bf41a0cfad9c0a Mon Sep 17 00:00:00 2001 From: barbacbd Date: Tue, 2 Dec 2025 14:31:48 -0500 Subject: [PATCH 3/3] Fix naming convention issues on common name packages. --- pkg/asset/agent/common/infraenv.go | 2 +- pkg/types/common/common.go | 2 +- pkg/utils/vmware.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/asset/agent/common/infraenv.go b/pkg/asset/agent/common/infraenv.go index fc44c704548..6dec4dc1e19 100644 --- a/pkg/asset/agent/common/infraenv.go +++ b/pkg/asset/agent/common/infraenv.go @@ -1,4 +1,4 @@ -package common +package common //nolint:revive import ( "context" diff --git a/pkg/types/common/common.go b/pkg/types/common/common.go index dc2b5563cac..782a7b8ea31 100644 --- a/pkg/types/common/common.go +++ b/pkg/types/common/common.go @@ -1,4 +1,4 @@ -package common +package common //nolint:revive import ( "errors" diff --git a/pkg/utils/vmware.go b/pkg/utils/vmware.go index 39a19bbec20..e169d0772e1 100644 --- a/pkg/utils/vmware.go +++ b/pkg/utils/vmware.go @@ -1,4 +1,4 @@ -package utils +package utils //nolint:revive import ( "encoding/hex"