From abbfd91119d44378f15c330f190b3fc4f4e5599b Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Mon, 11 Sep 2023 04:55:19 +0200 Subject: [PATCH] feat: replace io fs finder with afero finder Signed-off-by: Mark Sagi-Kazar --- go.mod | 2 +- go.sum | 4 ++-- viper_go1_16.go | 13 ++++++------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index f0ee142..d087954 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/mitchellh/mapstructure v1.5.0 github.com/pelletier/go-toml/v2 v2.1.0 github.com/sagikazarmark/crypt v0.14.0 - github.com/sagikazarmark/go-finder v0.1.0 + github.com/sagikazarmark/locafero v0.1.0 github.com/sagikazarmark/slog-shim v0.1.0 github.com/spf13/afero v1.9.5 github.com/spf13/cast v1.5.1 diff --git a/go.sum b/go.sum index fe36160..ab45609 100644 --- a/go.sum +++ b/go.sum @@ -330,8 +330,8 @@ github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZV github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sagikazarmark/crypt v0.14.0 h1:+QD5vjd6aZd6moHuIRVL+uJO7fkhiRjMz3ldbZQY5go= github.com/sagikazarmark/crypt v0.14.0/go.mod h1:JuxBJUNXrVOAywrtQNTZpOeTgcL1Az5qM7jKVDOifig= -github.com/sagikazarmark/go-finder v0.1.0 h1:5f1zyaYxU8FBMyPW7XnFOH6xZ6O9hm+m65CNjQ5snCM= -github.com/sagikazarmark/go-finder v0.1.0/go.mod h1:kS8MkoGpA6O0X1ddmi8O5g9YXwbVd9grjG8XCVehFEY= +github.com/sagikazarmark/locafero v0.1.0 h1:Am9aZ48Z6hbPm2MEPT2tYaruWPhPgjFJcGn8RmT1ask= +github.com/sagikazarmark/locafero v0.1.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= diff --git a/viper_go1_16.go b/viper_go1_16.go index c5a1a5b..4899a13 100644 --- a/viper_go1_16.go +++ b/viper_go1_16.go @@ -6,8 +6,7 @@ package viper import ( "fmt" - "github.com/sagikazarmark/go-finder" - "github.com/spf13/afero" + "github.com/sagikazarmark/locafero" ) // Search all configPaths for any config file. @@ -16,18 +15,18 @@ func (v *Viper) findConfigFile() (string, error) { var names []string if v.configType != "" { - names = finder.NameWithOptionalExtensions(v.configName, SupportedExts...) + names = locafero.NameWithOptionalExtensions(v.configName, SupportedExts...) } else { - names = finder.NameWithExtensions(v.configName, SupportedExts...) + names = locafero.NameWithExtensions(v.configName, SupportedExts...) } - finder := finder.Finder{ + finder := locafero.Finder{ Paths: v.configPaths, Names: names, - Type: finder.FileTypeFile, + Type: locafero.FileTypeFile, } - results, err := finder.Find(afero.NewIOFS(v.fs)) + results, err := locafero.Find(v.fs) if err != nil { return "", err }