Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-07-30 23:32:03 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-07-30 23:32:03 +0300
commitb426c20e1494f2c0868673795532b84a0353ced8 (patch)
tree6805c35b421e6157b589199cdd3486f70c263296 /helpers
parent15b66935419089ce465f5d4d6ac159a7aaa76cb4 (diff)
Return specific error on walk path too short
Diffstat (limited to 'helpers')
-rw-r--r--helpers/path.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/helpers/path.go b/helpers/path.go
index 3c0d530f2..0c18e5397 100644
--- a/helpers/path.go
+++ b/helpers/path.go
@@ -462,6 +462,8 @@ func FindCWD() (string, error) {
return path, nil
}
+var WalkRootTooShortError = errors.New("Path too short. Stop walking.")
+
// SymbolicWalk is like filepath.Walk, but it supports the root being a
// symbolic link. It will still not follow symbolic links deeper down in
// the file structure
@@ -469,7 +471,7 @@ func SymbolicWalk(fs afero.Fs, root string, walker filepath.WalkFunc) error {
// Sanity check
if len(root) < 4 {
- return fmt.Errorf("Path to short, cannot walk the root: %s", root)
+ return WalkRootTooShortError
}
// Handle the root first