diff --git a/pkg/pr/deletes.go b/pkg/pr/deletes.go index 2314cda3..684d6874 100644 --- a/pkg/pr/deletes.go +++ b/pkg/pr/deletes.go @@ -15,7 +15,7 @@ func applyDeletes(deletes *DeleteSpec, ctx map[string]interface{}) error { dest = []byte(f) } - if err := os.Remove(string(dest)); err != nil { + if err := removeMatches(string(dest)); err != nil { return err } } diff --git a/pkg/pr/utils.go b/pkg/pr/utils.go index 8bca4849..454af4c0 100644 --- a/pkg/pr/utils.go +++ b/pkg/pr/utils.go @@ -40,3 +40,18 @@ func replaceTo(from, to string, rep func(data []byte) ([]byte, error)) error { func replaceInPlace(path string, rep func(data []byte) ([]byte, error)) error { return replaceTo(path, path, rep) } + +func removeMatches(glob string) error { + matches, err := filepath.Glob(glob) + if err != nil { + return err + } + + for _, match := range matches { + if err := os.Remove(match); err != nil { + return err + } + } + + return nil +}