summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-12-14 12:20:13 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-12-14 13:51:06 +0100
commitad2059878a8d6ace9669ccc5ff0a8d4e5811ad37 (patch)
tree34d88705ab22e5b54949a6ce48e028b1fc2ab7e6 /modules
parent87e898a17a52b5338bc9d554dd12b99a54aa2431 (diff)
Also consider wrapped errors when checking for file IsNotExist errors
Fixes #10534
Diffstat (limited to 'modules')
-rw-r--r--modules/client.go8
-rw-r--r--modules/collect.go3
2 files changed, 7 insertions, 4 deletions
diff --git a/modules/client.go b/modules/client.go
index 78ba9f5ae..953391e59 100644
--- a/modules/client.go
+++ b/modules/client.go
@@ -29,6 +29,7 @@ import (
"time"
"github.com/gohugoio/hugo/common/collections"
+ "github.com/gohugoio/hugo/common/herrors"
"github.com/gohugoio/hugo/common/hexec"
hglob "github.com/gohugoio/hugo/hugofs/glob"
@@ -193,7 +194,8 @@ func (c *Client) Tidy() error {
//
// We, by default, use the /_vendor folder first, if found. To disable,
// run with
-// hugo --ignoreVendorPaths=".*"
+//
+// hugo --ignoreVendorPaths=".*"
//
// Given a module tree, Hugo will pick the first module for a given path,
// meaning that if the top-level module is vendored, that will be the full
@@ -297,7 +299,7 @@ func (c *Client) Vendor() error {
configFiles = append(configFiles, filepath.Join(dir, "theme.toml"))
for _, configFile := range configFiles {
if err := hugio.CopyFile(c.fs, configFile, filepath.Join(vendorDir, t.Path(), filepath.Base(configFile))); err != nil {
- if !os.IsNotExist(err) {
+ if !herrors.IsNotExist(err) {
return err
}
}
@@ -560,7 +562,7 @@ func (c *Client) rewriteGoModRewrite(name string, isGoMod map[string]bool) ([]by
b := &bytes.Buffer{}
f, err := c.fs.Open(filepath.Join(c.ccfg.WorkingDir, name))
if err != nil {
- if os.IsNotExist(err) {
+ if herrors.IsNotExist(err) {
// It's been deleted.
return nil, nil
}
diff --git a/modules/collect.go b/modules/collect.go
index ff83f9ecc..7d92e3045 100644
--- a/modules/collect.go
+++ b/modules/collect.go
@@ -23,6 +23,7 @@ import (
"time"
"github.com/bep/debounce"
+ "github.com/gohugoio/hugo/common/herrors"
"github.com/gohugoio/hugo/common/loggers"
"github.com/spf13/cast"
@@ -539,7 +540,7 @@ func (c *collector) collectModulesTXT(owner Module) error {
f, err := c.fs.Open(filename)
if err != nil {
- if os.IsNotExist(err) {
+ if herrors.IsNotExist(err) {
return nil
}