aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugofs/rootmapping_fs.go
diff options
context:
space:
mode:
authorCameron Moore <[email protected]>2018-09-06 14:21:18 -0500
committerBjørn Erik Pedersen <[email protected]>2018-09-07 08:25:51 +0200
commit5f2e1cb8969c2adac6c866b57cc331e1bc16d4e9 (patch)
treeca4ceccceed92f9be53d44c889789c902f62fd1e /hugofs/rootmapping_fs.go
parentc8ce65046dc7539f3bf5f6dd35fa7ece2bec866d (diff)
downloadhugo-5f2e1cb8969c2adac6c866b57cc331e1bc16d4e9.tar.gz
hugo-5f2e1cb8969c2adac6c866b57cc331e1bc16d4e9.zip
hugofs: Fix golint issues
Fix godoc issues and the following: hugofs/noop_fs.go:25:2: error var noOpErr should have name of the form errFoo
Diffstat (limited to 'hugofs/rootmapping_fs.go')
-rw-r--r--hugofs/rootmapping_fs.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/hugofs/rootmapping_fs.go b/hugofs/rootmapping_fs.go
index 59f49f3a9..176edaa07 100644
--- a/hugofs/rootmapping_fs.go
+++ b/hugofs/rootmapping_fs.go
@@ -94,6 +94,8 @@ func NewRootMappingFs(fs afero.Fs, fromTo ...string) (*RootMappingFs, error) {
rootMapToReal: rootMapToReal.Commit().Root()}, nil
}
+// Stat returns the os.FileInfo structure describing a given file. If there is
+// an error, it will be of type *os.PathError.
func (fs *RootMappingFs) Stat(name string) (os.FileInfo, error) {
if fs.isRoot(name) {
return newRootMappingDirFileInfo(name), nil
@@ -107,6 +109,7 @@ func (fs *RootMappingFs) isRoot(name string) bool {
}
+// Open opens the named file for reading.
func (fs *RootMappingFs) Open(name string) (afero.File, error) {
if fs.isRoot(name) {
return &rootMappingFile{name: name, fs: fs}, nil
@@ -119,6 +122,9 @@ func (fs *RootMappingFs) Open(name string) (afero.File, error) {
return &rootMappingFile{File: f, name: name, fs: fs}, nil
}
+// LstatIfPossible returns the os.FileInfo structure describing a given file.
+// It attempts to use Lstat if supported or defers to the os. In addition to
+// the FileInfo, a boolean is returned telling whether Lstat was called.
func (fs *RootMappingFs) LstatIfPossible(name string) (os.FileInfo, bool, error) {
if fs.isRoot(name) {
return newRootMappingDirFileInfo(name), false, nil