aboutsummaryrefslogtreecommitdiffhomepage
path: root/create/content.go
diff options
context:
space:
mode:
Diffstat (limited to 'create/content.go')
-rw-r--r--create/content.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/create/content.go b/create/content.go
index 9034ba299..5f05e25f9 100644
--- a/create/content.go
+++ b/create/content.go
@@ -27,7 +27,7 @@ import (
"github.com/gohugoio/hugo/common/hexec"
"github.com/gohugoio/hugo/common/paths"
- "github.com/pkg/errors"
+ "errors"
"github.com/gohugoio/hugo/hugofs/files"
@@ -94,11 +94,11 @@ func NewContent(h *hugolib.HugoSites, kind, targetPath string) error {
}
if ext == "" {
- return "", errors.Errorf("failed to resolve %q to a archetype template", targetPath)
+ return "", fmt.Errorf("failed to resolve %q to a archetype template", targetPath)
}
if !files.IsContentFile(b.targetPath) {
- return "", errors.Errorf("target path %q is not a known content format", b.targetPath)
+ return "", fmt.Errorf("target path %q is not a known content format", b.targetPath)
}
return b.buildFile()
@@ -188,14 +188,14 @@ func (b *contentBuilder) buildDir() error {
in, err := meta.Open()
if err != nil {
- return errors.Wrap(err, "failed to open non-content file")
+ return fmt.Errorf("failed to open non-content file: %w", err)
}
targetFilename := filepath.Join(baseDir, b.targetPath, strings.TrimPrefix(filename, b.archetypeFilename))
targetDir := filepath.Dir(targetFilename)
if err := b.sourceFs.MkdirAll(targetDir, 0o777); err != nil && !os.IsExist(err) {
- return errors.Wrapf(err, "failed to create target directory for %q", targetDir)
+ return fmt.Errorf("failed to create target directory for %q: %w", targetDir, err)
}
out, err := b.sourceFs.Create(targetFilename)
@@ -329,7 +329,7 @@ func (b *contentBuilder) mapArcheTypeDir() error {
w := hugofs.NewWalkway(walkCfg)
if err := w.Walk(); err != nil {
- return errors.Wrapf(err, "failed to walk archetype dir %q", b.archetypeFilename)
+ return fmt.Errorf("failed to walk archetype dir %q: %w", b.archetypeFilename, err)
}
b.dirMap = m
@@ -374,7 +374,7 @@ func (b *contentBuilder) usesSiteVar(filename string) (bool, error) {
}
bb, err := afero.ReadFile(b.archeTypeFs, filename)
if err != nil {
- return false, errors.Wrap(err, "failed to open archetype file")
+ return false, fmt.Errorf("failed to open archetype file: %w", err)
}
return bytes.Contains(bb, []byte(".Site")) || bytes.Contains(bb, []byte("site.")), nil