1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
package scanner import ( "path/filepath" "strings" ) var supportedExtensions = map[string]struct{}{ ".jpg": {}, ".jpeg": {}, ".png": {}, ".gif": {}, ".webp": {}, } func isImage(path string) bool { ext := strings.ToLower(filepath.Ext(path)) _, ok := supportedExtensions[ext] return ok }