diff options
Diffstat (limited to 'modules/collect.go')
-rw-r--r-- | modules/collect.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/collect.go b/modules/collect.go index 6c47bde5c..a4066a46c 100644 --- a/modules/collect.go +++ b/modules/collect.go @@ -17,6 +17,7 @@ import ( "bufio" "errors" "fmt" + "io/fs" "os" "path/filepath" "regexp" @@ -36,7 +37,7 @@ import ( "github.com/gohugoio/hugo/hugofs/files" - "github.com/rogpeppe/go-internal/module" + "golang.org/x/mod/module" "github.com/gohugoio/hugo/config" "github.com/spf13/afero" @@ -282,6 +283,7 @@ func (c *collector) add(owner *moduleAdapter, moduleImport Import) (*moduleAdapt return nil, nil } if found, _ := afero.Exists(c.fs, moduleDir); !found { + //lint:ignore ST1005 end user message. c.err = c.wrapModuleNotFound(fmt.Errorf(`module %q not found in %q; either add it as a Hugo Module or store it in %q.`, modulePath, moduleDir, c.ccfg.ThemesDir)) return nil, nil } @@ -599,7 +601,12 @@ func (c *collector) mountCommonJSConfig(owner *moduleAdapter, mounts []Mount) ([ } // Mount the common JS config files. - fis, err := afero.ReadDir(c.fs, owner.Dir()) + d, err := c.fs.Open(owner.Dir()) + if err != nil { + return mounts, fmt.Errorf("failed to open dir %q: %q", owner.Dir(), err) + } + defer d.Close() + fis, err := d.(fs.ReadDirFile).ReadDir(-1) if err != nil { return mounts, fmt.Errorf("failed to read dir %q: %q", owner.Dir(), err) } |