aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugofs
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2020-10-21 11:17:48 +0200
committerBjørn Erik Pedersen <[email protected]>2020-10-22 09:09:29 +0200
commitfdfa4a5fe62232f65f1dd8d6fe0c500374228788 (patch)
treeb804e91506a7f3c58690c6fd774b28f95184d5dc /hugofs
parent8cbe2bbfad6aa4de267921e24e166d4addf47040 (diff)
downloadhugo-fdfa4a5fe62232f65f1dd8d6fe0c500374228788.tar.gz
hugo-fdfa4a5fe62232f65f1dd8d6fe0c500374228788.zip
Allow getJSON errors to be ignored
This change is mostly motivated to get a more stable CI build (we're building the Hugo site there, with Instagram and Twitter shortcodes sometimes failing). Fixes #7866
Diffstat (limited to 'hugofs')
-rw-r--r--hugofs/nosymlink_fs.go4
-rw-r--r--hugofs/nosymlink_test.go4
-rw-r--r--hugofs/walk.go10
3 files changed, 9 insertions, 9 deletions
diff --git a/hugofs/nosymlink_fs.go b/hugofs/nosymlink_fs.go
index 409b6f03d..fa89d61e0 100644
--- a/hugofs/nosymlink_fs.go
+++ b/hugofs/nosymlink_fs.go
@@ -28,14 +28,14 @@ var (
)
// NewNoSymlinkFs creates a new filesystem that prevents symlinks.
-func NewNoSymlinkFs(fs afero.Fs, logger *loggers.Logger, allowFiles bool) afero.Fs {
+func NewNoSymlinkFs(fs afero.Fs, logger loggers.Logger, allowFiles bool) afero.Fs {
return &noSymlinkFs{Fs: fs, logger: logger, allowFiles: allowFiles}
}
// noSymlinkFs is a filesystem that prevents symlinking.
type noSymlinkFs struct {
allowFiles bool // block dirs only
- logger *loggers.Logger
+ logger loggers.Logger
afero.Fs
}
diff --git a/hugofs/nosymlink_test.go b/hugofs/nosymlink_test.go
index c938da006..f541fc0a7 100644
--- a/hugofs/nosymlink_test.go
+++ b/hugofs/nosymlink_test.go
@@ -68,7 +68,7 @@ func TestNoSymlinkFs(t *testing.T) {
for _, bfs := range []afero.Fs{NewBaseFileDecorator(Os), Os} {
for _, allowFiles := range []bool{false, true} {
- logger.WarnCounter.Reset()
+ logger.LogCounters().WarnCounter.Reset()
fs := NewNoSymlinkFs(bfs, logger, allowFiles)
ls := fs.(afero.Lstater)
symlinkedDir := filepath.Join(workDir, "symlinkdedir")
@@ -139,7 +139,7 @@ func TestNoSymlinkFs(t *testing.T) {
_, err = f.Readdir(-1)
c.Assert(err, qt.IsNil)
f.Close()
- c.Assert(logger.WarnCounter.Count(), qt.Equals, uint64(1))
+ c.Assert(logger.LogCounters().WarnCounter.Count(), qt.Equals, uint64(1))
}
}
diff --git a/hugofs/walk.go b/hugofs/walk.go
index da6983f11..91dd386e2 100644
--- a/hugofs/walk.go
+++ b/hugofs/walk.go
@@ -37,7 +37,7 @@ type Walkway struct {
root string
basePath string
- logger *loggers.Logger
+ logger loggers.Logger
// May be pre-set
fi FileMetaInfo
@@ -59,7 +59,7 @@ type WalkwayConfig struct {
Root string
BasePath string
- Logger *loggers.Logger
+ Logger loggers.Logger
// One or both of these may be pre-set.
Info FileMetaInfo
@@ -158,15 +158,15 @@ func (w *Walkway) checkErr(filename string, err error) bool {
// The file may be removed in process.
// This may be a ERROR situation, but it is not possible
// to determine as a general case.
- w.logger.WARN.Printf("File %q not found, skipping.", filename)
+ w.logger.Warnf("File %q not found, skipping.", filename)
return true
}
return false
}
-func logUnsupportedSymlink(filename string, logger *loggers.Logger) {
- logger.WARN.Printf("Unsupported symlink found in %q, skipping.", filename)
+func logUnsupportedSymlink(filename string, logger loggers.Logger) {
+ logger.Warnf("Unsupported symlink found in %q, skipping.", filename)
}
// walk recursively descends path, calling walkFn.