1
0
mirror of https://github.com/openshift/installer.git synced 2026-02-05 15:47:14 +01:00

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 ==.
This commit is contained in:
barbacbd
2025-12-01 14:07:07 -05:00
parent 75bbd5db17
commit ffca92e42a
4 changed files with 6 additions and 8 deletions

View File

@@ -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
}

View File

@@ -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,

View File

@@ -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 {

View File

@@ -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
}