Clean YAML files before generating the new ones in manifests and helm-chart command

This commit is contained in:
M. Mert Yildiran
2023-04-20 04:00:37 +03:00
parent e65656c1df
commit 2780791068
3 changed files with 38 additions and 2 deletions

22
misc/fsUtils/globUtils.go Normal file
View File

@@ -0,0 +1,22 @@
package fsUtils
import (
"fmt"
"os"
"path/filepath"
)
func RemoveFilesByExtension(dirPath string, ext string) error {
files, err := filepath.Glob(filepath.Join(dirPath, fmt.Sprintf("/*.%s", ext)))
if err != nil {
return err
}
for _, f := range files {
if err := os.Remove(f); err != nil {
return err
}
}
return nil
}