diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2018-08-01 00:37:11 +0100 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2018-08-01 00:37:11 +0100 |
commit | e2b4c3882762406fd3da16f5865cfc3e36e048b5 (patch) | |
tree | 4554004f44fe69a759d37191b8a6236ec0f2c90e /vendor/github.com/gobuffalo/packr/builder/clean.go | |
parent | 925bc7eb676e25341e30d64da4d12c0e93102cdf (diff) |
Migrate from esc to packr for static files
Diffstat (limited to 'vendor/github.com/gobuffalo/packr/builder/clean.go')
-rw-r--r-- | vendor/github.com/gobuffalo/packr/builder/clean.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/vendor/github.com/gobuffalo/packr/builder/clean.go b/vendor/github.com/gobuffalo/packr/builder/clean.go new file mode 100644 index 0000000..688ebf5 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/builder/clean.go @@ -0,0 +1,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 + }) +} |