Skip to content

Commit 1a378fa

Browse files
committed
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 ==.
1 parent 54f4b77 commit 1a378fa

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

pkg/agent/logging.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func printChannelLogs(ip string, ch chan logEntry) {
6464
func printLogs(wg *sync.WaitGroup, ipChanMap map[string]chan logEntry) {
6565
defer wg.Done()
6666
for {
67-
if len(ipChanMap) == 0 {
67+
if len(ipChanMap) == 0 { //nolint: staticcheck
6868
// no IPs to monitor or all channels are closed, exit loop
6969
break
7070
}

pkg/asset/manifests/azure/cluster.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,13 +495,14 @@ func getSubnet(installConfig *installconfig.InstallConfig, subnetType capz.Subne
495495
}
496496
ctx := context.TODO()
497497

498-
if subnetType == capz.SubnetControlPlane {
498+
switch subnetType {
499+
case capz.SubnetControlPlane:
499500
subnet, err = azClient.GetControlPlaneSubnet(ctx,
500501
installConfig.Config.Azure.NetworkResourceGroupName,
501502
installConfig.Config.Azure.VirtualNetwork,
502503
subnetName,
503504
)
504-
} else if subnetType == capz.SubnetNode {
505+
case capz.SubnetNode:
505506
subnet, err = azClient.GetComputeSubnet(ctx,
506507
installConfig.Config.Azure.NetworkResourceGroupName,
507508
installConfig.Config.Azure.VirtualNetwork,

pkg/infrastructure/azure/storage.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,7 @@ func CreateStorageAccount(ctx context.Context, in *CreateStorageAccountInput) (*
8181
//APIVersion: "2019-06-01",
8282
},
8383
}
84-
allowSharedKeyAccess := true
85-
if in.AuthType == azic.ManagedIdentityAuth {
86-
allowSharedKeyAccess = false
87-
}
84+
allowSharedKeyAccess := in.AuthType != azic.ManagedIdentityAuth
8885

8986
storageClientFactory, err := armstorage.NewClientFactory(in.SubscriptionID, in.TokenCredential, opts)
9087
if err != nil {

pkg/infrastructure/baremetal/image.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (i *localImage) Import(copier func(io.Reader) error, vol libvirtxml.Storage
7777
}
7878
// we can skip the upload if the modification times are the same
7979
if vol.Target.Timestamps != nil && vol.Target.Timestamps.Mtime != "" {
80-
if fi.ModTime() == timeFromEpoch(vol.Target.Timestamps.Mtime) {
80+
if fi.ModTime().Equal(timeFromEpoch(vol.Target.Timestamps.Mtime)) {
8181
logrus.Info("Modification time is the same: skipping image copy")
8282
return nil
8383
}

0 commit comments

Comments
 (0)