aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugofs
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2021-06-05 11:45:56 +0200
committerBjørn Erik Pedersen <[email protected]>2021-06-05 11:45:56 +0200
commit06d295427f798da85de469924fd10f58c0de9a58 (patch)
treed26450b17dfa8f8027eb21a57731bc803241da94 /hugofs
parent26ae12c0c64b847d24bde60d7d710ea2efcb40d4 (diff)
downloadhugo-06d295427f798da85de469924fd10f58c0de9a58.tar.gz
hugo-06d295427f798da85de469924fd10f58c0de9a58.zip
hugofs: Set modTime at creation time
As `ModTime()` should return the same value on each invocation. See #6161
Diffstat (limited to 'hugofs')
-rw-r--r--hugofs/fileinfo.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/hugofs/fileinfo.go b/hugofs/fileinfo.go
index 17fb62ea2..4f318205a 100644
--- a/hugofs/fileinfo.go
+++ b/hugofs/fileinfo.go
@@ -264,7 +264,8 @@ func mergeFileMeta(from, to FileMeta) {
}
type dirNameOnlyFileInfo struct {
- name string
+ name string
+ modTime time.Time
}
func (fi *dirNameOnlyFileInfo) Name() string {
@@ -280,7 +281,7 @@ func (fi *dirNameOnlyFileInfo) Mode() os.FileMode {
}
func (fi *dirNameOnlyFileInfo) ModTime() time.Time {
- return time.Now()
+ return fi.modTime
}
func (fi *dirNameOnlyFileInfo) IsDir() bool {
@@ -303,7 +304,7 @@ func newDirNameOnlyFileInfo(name string, meta FileMeta, fileOpener func() (afero
m[metaKeyIsOrdered] = false
return NewFileMetaInfo(
- &dirNameOnlyFileInfo{name: base},
+ &dirNameOnlyFileInfo{name: base, modTime: time.Now()},
m,
)
}