From a48ecf56a95ae3e089322bd15a182128d5055197 Mon Sep 17 00:00:00 2001 From: James Phillips Date: Thu, 23 Feb 2017 21:01:06 -0800 Subject: [PATCH] Exports visit function from base. --- command/base/config_util.go | 6 +++--- command/base/config_util_test.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/command/base/config_util.go b/command/base/config_util.go index 7eac69cd27..d65693bf6f 100644 --- a/command/base/config_util.go +++ b/command/base/config_util.go @@ -254,14 +254,14 @@ func float64ToUintValueFunc() mapstructure.DecodeHookFunc { } } -// visitFn is a callback that gets a chance to visit each file found during a +// VisitFn is a callback that gets a chance to visit each file found during a // traversal with visit(). -type visitFn func(path string) error +type VisitFn func(path string) error // visit will call the visitor function on the path if it's a file, or for each // file in the path if it's a directory. Directories will not be recursed into, // and files in the directory will be visited in alphabetical order. -func visit(path string, visitor visitFn) error { +func Visit(path string, visitor VisitFn) error { f, err := os.Open(path) if err != nil { return fmt.Errorf("error reading %q: %v", path, err) diff --git a/command/base/config_util_test.go b/command/base/config_util_test.go index b8264751fb..c7640fb52a 100644 --- a/command/base/config_util_test.go +++ b/command/base/config_util_test.go @@ -108,10 +108,10 @@ func TestConfigUtil_Visit(t *testing.T) { } basePath := "../../test/command/merge" - if err := visit(basePath, visitor); err != nil { + if err := Visit(basePath, visitor); err != nil { t.Fatalf("err: %v", err) } - if err := visit(path.Join(basePath, "subdir", "c.json"), visitor); err != nil { + if err := Visit(path.Join(basePath, "subdir", "c.json"), visitor); err != nil { t.Fatalf("err: %v", err) }