Skip to content

Commit

Permalink
address golangci-lint complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomitn committed Aug 25, 2024
1 parent 0779eb2 commit fefffe3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ func GetService(port int, namespace string) *apiv1.Service {
Spec: apiv1.ServiceSpec{
Ports: []apiv1.ServicePort{
{Protocol: "TCP",
TargetPort: intstr.IntOrString{IntVal: int32(port)},
Port: int32(port),
TargetPort: intstr.IntOrString{IntVal: uint32(port)},

Check failure on line 61 in console/console.go

View workflow job for this annotation

GitHub Actions / precheck-and-build (1.19)

cannot use uint32(port) (value of type uint32) as type int32 in struct literal
Port: uint32(port),

Check failure on line 62 in console/console.go

View workflow job for this annotation

GitHub Actions / precheck-and-build (1.19)

cannot use uint32(port) (value of type uint32) as type int32 in struct literal
Name: "console-port",
},
},
Expand All @@ -81,7 +81,7 @@ func GetConsolePluginCR(consolePort int, basePath string, serviceNamespace strin
Service: consolev1alpha1.ConsolePluginService{
Name: "ibm-odf-console-service",
Namespace: serviceNamespace,
Port: int32(consolePort),
Port: uint32(consolePort),

Check failure on line 84 in console/console.go

View workflow job for this annotation

GitHub Actions / precheck-and-build (1.19)

cannot use uint32(consolePort) (value of type uint32) as type int32 in struct literal
BasePath: basePath,
},
},
Expand Down
2 changes: 1 addition & 1 deletion controllers/flashsystemcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ func (r *FlashSystemClusterReconciler) ensureDefaultStorageClass(instance *odfv1
msg := "storageClass with same name already exists and doesn't match ODF-FS requirements. " +
"Deletion of existing StorageClass is required. Failing FlashSystemCluster reconcile"
r.createEvent(instance, corev1.EventTypeWarning, util.DeletedDuplicatedStorageClassReason, msg)
return fmt.Errorf(msg)
return fmt.Errorf("%s", msg)
}

r.Log.Info("create default StorageClass")
Expand Down
6 changes: 3 additions & 3 deletions controllers/persistentvolume/persistentvolume_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,22 +254,22 @@ func (r *PersistentVolumeWatcher) getPVManagementAddress(pv *corev1.PersistentVo
if pvVolumeHandle == "" {
msg := "volumeHandle cannot be empty"
r.Log.Error(nil, msg)
return "", fmt.Errorf(msg)
return "", fmt.Errorf("%s", msg)
}

pvVolumeHandleList := strings.Split(pvVolumeHandle, ":")
if len(pvVolumeHandleList) < 2 {
msg := "volumeHandle must contain system id"
r.Log.Error(nil, msg)
return "", fmt.Errorf(msg)
return "", fmt.Errorf("%s", msg)
}

pvMgmtId := pvVolumeHandleList[1]
matchSecretMgmtData, exist := secretMgmtDataByMgmtId[pvMgmtId]
if !exist {
msg := "could not find system id in topology Secret"
r.Log.Error(nil, msg)
return "", fmt.Errorf(msg)
return "", fmt.Errorf("%s", msg)
}

pvMgmtAddr = matchSecretMgmtData.(map[string]interface{})[util.SecretManagementAddressKey].(string)
Expand Down
6 changes: 3 additions & 3 deletions controllers/storageclass/storageclass_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func (r *StorageClassWatcher) ensureConfigMapUpdated(request reconcile.Request,
if !fscExist {
msg := "failed to get FlashSystemCluster entry from pools ConfigMap"
r.Log.Error(nil, msg, "FlashSystemCluster", fscName, "ConfigMap", configMap.Name)
return fmt.Errorf(msg)
return fmt.Errorf("%s", msg)
}
}

Expand Down Expand Up @@ -370,7 +370,7 @@ func (r *StorageClassWatcher) extractPoolName(sc storagev1.StorageClass, mgmtDat
if !ok {
msg := "failed to find the management id in the \"by_management_id\" parameter in the StorageClass"
r.Log.Error(nil, msg, "management id", mgmtId)
return poolName, fmt.Errorf(msg)
return poolName, fmt.Errorf("%s", msg)
}
byMgmtIdData := mgmtData.(map[string]interface{})
poolName, ok = byMgmtIdData[util.CsiIBMBlockScPool].(string)
Expand Down Expand Up @@ -437,7 +437,7 @@ func (r *StorageClassWatcher) addStorageClassToConfigMap(configMap corev1.Config
if !exist {
msg := "failed to get FlashSystemCluster entry from pools ConfigMap"
r.Log.Error(nil, msg, "FlashSystemCluster", fscName, "ConfigMap", configMap.Name)
return fmt.Errorf(msg)
return fmt.Errorf("%s", msg)
}

var fsMap util.FlashSystemClusterMapContent
Expand Down

0 comments on commit fefffe3

Please sign in to comment.