blob: 688ebf5de95962177feed5c19678116d240fe8b6 [file] [log] [blame]
package builder
import (
"fmt"
"os"
"path/filepath"
"strings"
"github.com/pkg/errors"
)
// Clean up an *-packr.go files
func Clean(root string) {
root, _ = filepath.EvalSymlinks(root)
filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
base := filepath.Base(path)
if base == ".git" || base == "vendor" || base == "node_modules" {
return filepath.SkipDir
}
if info == nil || info.IsDir() {
return nil
}
if strings.Contains(base, "-packr.go") {
err := os.Remove(path)
if err != nil {
fmt.Println(err)
return errors.WithStack(err)
}
}
return nil
})
}