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-08-31 13:08:11 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-08-31 13:08:11 +0300
commita0489c2dfd3ceb4d0702de0da7a4af3eabce05e5 (patch)
tree4ad63fa9ab0b5ade625140682a11821e79a531a9 /commands/commandeer.go
parent0fc2ce9e4bf0524994a861b7300e4332f6f8d390 (diff)
Avoid failing with "module not found" for hugo mod init and similar
Fixes #8940
Diffstat (limited to 'commands/commandeer.go')
-rw-r--r--commands/commandeer.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/commands/commandeer.go b/commands/commandeer.go
index bac96fa7a..b2a995ae6 100644
--- a/commands/commandeer.go
+++ b/commands/commandeer.go
@@ -309,7 +309,12 @@ func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {
doWithConfig)
if err != nil {
- return err
+ // We should improve the error handling here,
+ // but with hugo mod init and similar there is a chicken and egg situation
+ // with modules already configured in config.toml, so ignore those errors.
+ if mustHaveConfigFile || !moduleNotFoundRe.MatchString(err.Error()) {
+ return err
+ }
} else if mustHaveConfigFile && len(configFiles) == 0 {
return hugolib.ErrNoConfigFile
}