From 77fd089c1582149b262c61d071c03773dae262a9 Mon Sep 17 00:00:00 2001 From: Dor Date: Mon, 31 Oct 2022 14:21:48 +0200 Subject: [PATCH] Expand filter for `--ignore-generated` --- main.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index a20446c..7740080 100644 --- a/main.go +++ b/main.go @@ -204,9 +204,12 @@ func run() error { // in a file. It returns the original contents (useful for debugging), the // shortened version, and an error. func processFile(shortener *Shortener, path string) ([]byte, []byte, error) { - _, fileName := filepath.Split(path) - if *ignoreGenerated && strings.HasPrefix(fileName, "generated_") { - return nil, nil, nil + dirPath, fileName := filepath.Split(path) + if *ignoreGenerated { + dirName := filepath.Base(dirPath) + if strings.HasPrefix(fileName, "generated_") || strings.HasPrefix(dirName, "gen") { + return nil, nil, nil + } } log.Debugf("Processing file %s", path)