diff options
author | Bjørn Erik Pedersen <[email protected]> | 2021-06-05 11:45:56 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2021-06-05 11:45:56 +0200 |
commit | 06d295427f798da85de469924fd10f58c0de9a58 (patch) | |
tree | d26450b17dfa8f8027eb21a57731bc803241da94 | |
parent | 26ae12c0c64b847d24bde60d7d710ea2efcb40d4 (diff) | |
download | hugo-06d295427f798da85de469924fd10f58c0de9a58.tar.gz hugo-06d295427f798da85de469924fd10f58c0de9a58.zip |
hugofs: Set modTime at creation time
As `ModTime()` should return the same value on each invocation.
See #6161
-rw-r--r-- | hugofs/fileinfo.go | 7 |
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, ) } |