aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-09-19 10:53:39 +0200
committerBjørn Erik Pedersen <[email protected]>2024-09-19 12:26:04 +0200
commite363964f2fcbeabe4264eaa9d7f803c9989ad096 (patch)
tree1218d3e5f33015b5d671482fdd3a27c9c76c92fa /modules
parentc260cb28a9fe3d391530ecd9011ce6ed927f57f8 (diff)
downloadhugo-e363964f2fcbeabe4264eaa9d7f803c9989ad096.tar.gz
hugo-e363964f2fcbeabe4264eaa9d7f803c9989ad096.zip
commands: Ignore "module does not exist" errors in hugo mod init
Closes #11458
Diffstat (limited to 'modules')
-rw-r--r--modules/client.go3
-rw-r--r--modules/collect.go3
2 files changed, 6 insertions, 0 deletions
diff --git a/modules/client.go b/modules/client.go
index dce40d2db..70b3ac485 100644
--- a/modules/client.go
+++ b/modules/client.go
@@ -742,6 +742,9 @@ type ClientConfig struct {
// This can be nil.
IgnoreVendor glob.Glob
+ // Ignore any module not found errors.
+ IgnoreModuleDoesNotExist bool
+
// Absolute path to the project dir.
WorkingDir string
diff --git a/modules/collect.go b/modules/collect.go
index cfb6d9249..4eb12a1a6 100644
--- a/modules/collect.go
+++ b/modules/collect.go
@@ -699,6 +699,9 @@ func (c *collector) normalizeMounts(owner *moduleAdapter, mounts []Mount) ([]Mou
}
func (c *collector) wrapModuleNotFound(err error) error {
+ if c.Client.ccfg.IgnoreModuleDoesNotExist {
+ return nil
+ }
err = fmt.Errorf(err.Error()+": %w", ErrNotExist)
if c.GoModulesFilename == "" {
return err