diff --git a/cmd/files.go b/cmd/files.go index 5244ad1..b578a55 100644 --- a/cmd/files.go +++ b/cmd/files.go @@ -112,17 +112,19 @@ func humanReadableSize(bytes int) string { func getImageDimensions(path string) (*Dimensions, error) { file, err := os.Open(path) - if errors.Is(err, os.ErrNotExist) { + switch { + case errors.Is(err, os.ErrNotExist): return &Dimensions{}, nil - } else if err != nil { + case err != nil: return &Dimensions{}, err } defer file.Close() myImage, _, err := image.DecodeConfig(file) - if errors.Is(err, image.ErrFormat) { + switch { + case errors.Is(err, image.ErrFormat): return &Dimensions{Width: 0, Height: 0}, nil - } else if err != nil { + case err != nil: return &Dimensions{}, err } @@ -357,9 +359,10 @@ func pathIsValid(filePath string, paths []string) bool { func isImage(path string) (bool, error) { file, err := os.Open(path) - if errors.Is(err, os.ErrNotExist) { + switch { + case errors.Is(err, os.ErrNotExist): return false, nil - } else if err != nil { + case err != nil: return false, err } defer file.Close() diff --git a/cmd/version.go b/cmd/version.go index 88beaff..06b3109 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" ) -var Version = "0.25.0" +var Version = "0.25.1" func init() { rootCmd.AddCommand(versionCmd)