should omit comparison to bool constant in pkg/controller/controller_utils.go

This commit is contained in:
shawnhanx 2021-11-13 17:15:25 +08:00
parent e4c795168b
commit acc55500bc

View File

@ -504,10 +504,10 @@ func validateControllerRef(controllerRef *metav1.OwnerReference) error {
if len(controllerRef.Kind) == 0 { if len(controllerRef.Kind) == 0 {
return fmt.Errorf("controllerRef has empty Kind") return fmt.Errorf("controllerRef has empty Kind")
} }
if controllerRef.Controller == nil || *controllerRef.Controller != true { if controllerRef.Controller == nil || !*controllerRef.Controller {
return fmt.Errorf("controllerRef.Controller is not set to true") return fmt.Errorf("controllerRef.Controller is not set to true")
} }
if controllerRef.BlockOwnerDeletion == nil || *controllerRef.BlockOwnerDeletion != true { if controllerRef.BlockOwnerDeletion == nil || !*controllerRef.BlockOwnerDeletion {
return fmt.Errorf("controllerRef.BlockOwnerDeletion is not set") return fmt.Errorf("controllerRef.BlockOwnerDeletion is not set")
} }
return nil return nil