diff options
author | Bjørn Erik Pedersen <[email protected]> | 2020-02-19 10:39:36 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2020-02-19 17:14:35 +0100 |
commit | 0b96aba022d51cf9939605c029bb8dba806653a1 (patch) | |
tree | f7d2883a6ea85546e4e9536f6ccfb184bc4293af /cache | |
parent | fa520a2d983b982394ad10088393fb303e48980a (diff) | |
download | hugo-0b96aba022d51cf9939605c029bb8dba806653a1.tar.gz hugo-0b96aba022d51cf9939605c029bb8dba806653a1.zip |
commands: Add "hugo mod verify"
See #6907
Diffstat (limited to 'cache')
-rw-r--r-- | cache/filecache/filecache_pruner.go | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/cache/filecache/filecache_pruner.go b/cache/filecache/filecache_pruner.go index 7f68c8b82..b77f5331b 100644 --- a/cache/filecache/filecache_pruner.go +++ b/cache/filecache/filecache_pruner.go @@ -17,6 +17,8 @@ import ( "io" "os" + "github.com/gohugoio/hugo/hugofs" + "github.com/pkg/errors" "github.com/spf13/afero" ) @@ -121,18 +123,6 @@ func (c *Cache) pruneRootDir(force bool) (int, error) { return 0, nil } - counter := 0 - // Module cache has 0555 directories; make them writable in order to remove content. - afero.Walk(c.Fs, c.pruneAllRootDir, func(path string, info os.FileInfo, err error) error { - if err != nil { - return nil - } - if info.IsDir() { - counter++ - c.Fs.Chmod(path, 0777) - } - return nil - }) - return 1, c.Fs.RemoveAll(c.pruneAllRootDir) + return hugofs.MakeReadableAndRemoveAllModulePkgDir(c.Fs, c.pruneAllRootDir) } |