github.com/zachgersh/packr@v1.11.1/builder/clean.go (about) 1 package builder 2 3 import ( 4 "fmt" 5 "os" 6 "path/filepath" 7 "strings" 8 9 "github.com/pkg/errors" 10 ) 11 12 // Clean up an *-packr.go files 13 func Clean(root string) { 14 root, _ = filepath.EvalSymlinks(root) 15 filepath.Walk(root, func(path string, info os.FileInfo, err error) error { 16 base := filepath.Base(path) 17 if base == ".git" || base == "vendor" || base == "node_modules" { 18 return filepath.SkipDir 19 } 20 if info == nil || info.IsDir() { 21 return nil 22 } 23 if strings.Contains(base, "-packr.go") { 24 err := os.Remove(path) 25 if err != nil { 26 fmt.Println(err) 27 return errors.WithStack(err) 28 } 29 } 30 return nil 31 }) 32 }