diff --git a/pkg/volume/csi/csi_attacher.go b/pkg/volume/csi/csi_attacher.go index 2cb6ec7bc8e..59548e3944b 100644 --- a/pkg/volume/csi/csi_attacher.go +++ b/pkg/volume/csi/csi_attacher.go @@ -628,10 +628,7 @@ func getAttachmentName(volName, csiDriverName, nodeName string) string { // and false otherwise func isAttachmentName(unknownString string) bool { // 68 == "csi-" + len(sha256hash) - if strings.HasPrefix(unknownString, "csi-") && len(unknownString) == 68 { - return true - } - return false + return strings.HasPrefix(unknownString, "csi-") && len(unknownString) == 68 } func makeDeviceMountPath(plugin *csiPlugin, spec *volume.Spec) (string, error) { diff --git a/pkg/volume/csi/expander.go b/pkg/volume/csi/expander.go index 79f856a2feb..0d4e9b26d26 100644 --- a/pkg/volume/csi/expander.go +++ b/pkg/volume/csi/expander.go @@ -143,8 +143,5 @@ func inUseError(err error) bool { // if this is a failed precondition error then that means driver does not support expansion // of in-use volumes // More info - https://github.com/container-storage-interface/spec/blob/master/spec.md#controllerexpandvolume-errors - if st.Code() == codes.FailedPrecondition { - return true - } - return false + return st.Code() == codes.FailedPrecondition } diff --git a/pkg/volume/emptydir/empty_dir.go b/pkg/volume/emptydir/empty_dir.go index aa003a4b821..9b5f424e20b 100644 --- a/pkg/volume/emptydir/empty_dir.go +++ b/pkg/volume/emptydir/empty_dir.go @@ -88,10 +88,7 @@ func (plugin *emptyDirPlugin) GetVolumeName(spec *volume.Spec) (string, error) { } func (plugin *emptyDirPlugin) CanSupport(spec *volume.Spec) bool { - if spec.Volume != nil && spec.Volume.EmptyDir != nil { - return true - } - return false + return spec.Volume != nil && spec.Volume.EmptyDir != nil } func (plugin *emptyDirPlugin) RequiresRemount(spec *volume.Spec) bool { diff --git a/pkg/volume/flexvolume/driver-call.go b/pkg/volume/flexvolume/driver-call.go index 31f3be06d4d..ec0e74c3b82 100644 --- a/pkg/volume/flexvolume/driver-call.go +++ b/pkg/volume/flexvolume/driver-call.go @@ -249,11 +249,7 @@ func defaultCapabilities() *DriverCapabilities { // isCmdNotSupportedErr checks if the error corresponds to command not supported by // driver. func isCmdNotSupportedErr(err error) bool { - if err != nil && err.Error() == StatusNotSupported { - return true - } - - return false + return err != nil && err.Error() == StatusNotSupported } // handleCmdResponse processes the command output and returns the appropriate diff --git a/pkg/volume/util/types/types.go b/pkg/volume/util/types/types.go index c07dcfe215c..af309353ba7 100644 --- a/pkg/volume/util/types/types.go +++ b/pkg/volume/util/types/types.go @@ -148,10 +148,7 @@ func IsOperationFinishedError(err error) bool { // on PVC and actual filesystem on disk did not match func IsFilesystemMismatchError(err error) bool { mountError := mount.MountError{} - if errors.As(err, &mountError) && mountError.Type == mount.FilesystemMismatch { - return true - } - return false + return errors.As(err, &mountError) && mountError.Type == mount.FilesystemMismatch } // IsUncertainProgressError checks if given error is of type that indicates