blob: 688ebf5de95962177feed5c19678116d240fe8b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
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
})
}
|