Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-09-17 18:16:34 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-09-17 18:16:34 +0300
commit13ad8408fc6b645b12898fb8053388fc4848dfbd (patch)
tree8296c314574c156248136c386eab13f008a06830 /commands/mod.go
parent1cabf61ddf96b89c95c3ba77a985168184920feb (diff)
commands: Make the error handling for the mod commands more lenient
So it at least is possible to do a `hugo mod clean --all` if the cache is in a funky state.
Diffstat (limited to 'commands/mod.go')
-rw-r--r--commands/mod.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/commands/mod.go b/commands/mod.go
index 0f8239a4c..eb6b1a440 100644
--- a/commands/mod.go
+++ b/commands/mod.go
@@ -71,11 +71,12 @@ Also note that if you configure a positive maxAge for the "modules" file cache,
if all {
com, err := c.initConfig(false)
- if err != nil && !moduleNotFoundRe.MatchString(err.Error()) {
+ if err != nil && com == nil {
return err
}
- _, err = com.hugo().FileCaches.ModulesCache().Prune(true)
+ count, err := com.hugo().FileCaches.ModulesCache().Prune(true)
+ com.logger.Printf("Deleted %d files from module cache.", count)
return err
}
return c.withModsClient(true, func(c *modules.Client) error {