Allow exists util function to take afero.Fs so it can be used with non-deafult instances of Viper (#405) - viper - [fork] go viper port for 9front
 (HTM) git clone git@git.drkhsh.at/viper.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 4dddf7c62e16bce5807744018f5b753bfe21bbd2
 (DIR) parent 8ef37cbca71638bf32f3d5e194117d4cb46da163
 (HTM) Author: Jeff Lindsay <progrium@gmail.com>
       Date:   Thu,  9 Nov 2017 14:57:16 -0600
       
       Allow exists util function to take afero.Fs so it can be used with non-deafult instances of Viper (#405)
       
       Signed-off-by: Jeff Lindsay <progrium@gmail.com>
       Diffstat:
         M util.go                             |       5 +++--
         M viper.go                            |       2 +-
       
       2 files changed, 4 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/util.go b/util.go
       @@ -24,6 +24,7 @@ import (
                "github.com/hashicorp/hcl"
                "github.com/magiconair/properties"
                toml "github.com/pelletier/go-toml"
       +        "github.com/spf13/afero"
                "github.com/spf13/cast"
                jww "github.com/spf13/jwalterweatherman"
                "gopkg.in/yaml.v2"
       @@ -121,8 +122,8 @@ func absPathify(inPath string) string {
        }
        
        // Check if File / Directory Exists
       -func exists(path string) (bool, error) {
       -        _, err := v.fs.Stat(path)
       +func exists(fs afero.Fs, path string) (bool, error) {
       +        _, err := fs.Stat(path)
                if err == nil {
                        return true, nil
                }
 (DIR) diff --git a/viper.go b/viper.go
       @@ -1537,7 +1537,7 @@ func (v *Viper) searchInPath(in string) (filename string) {
                jww.DEBUG.Println("Searching for config in ", in)
                for _, ext := range SupportedExts {
                        jww.DEBUG.Println("Checking for", filepath.Join(in, v.configName+"."+ext))
       -                if b, _ := exists(filepath.Join(in, v.configName+"."+ext)); b {
       +                if b, _ := exists(v.fs, filepath.Join(in, v.configName+"."+ext)); b {
                                jww.DEBUG.Println("Found: ", filepath.Join(in, v.configName+"."+ext))
                                return filepath.Join(in, v.configName+"."+ext)
                        }