mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-16 17:03:01 -06:00
[chore] bumps our spf13/viper version (#3943)
* bumps our spf13/viper version * fixes the one breaking change
This commit is contained in:
parent
1bf40e755c
commit
f46e490c30
147 changed files with 4637 additions and 18493 deletions
55
vendor/github.com/spf13/viper/finder.go
generated
vendored
Normal file
55
vendor/github.com/spf13/viper/finder.go
generated
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
package viper
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
)
|
||||
|
||||
// WithFinder sets a custom [Finder].
|
||||
func WithFinder(f Finder) Option {
|
||||
return optionFunc(func(v *Viper) {
|
||||
if f == nil {
|
||||
return
|
||||
}
|
||||
|
||||
v.finder = f
|
||||
})
|
||||
}
|
||||
|
||||
// Finder looks for files and directories in an [afero.Fs] filesystem.
|
||||
type Finder interface {
|
||||
Find(fsys afero.Fs) ([]string, error)
|
||||
}
|
||||
|
||||
// Finders combines multiple finders into one.
|
||||
func Finders(finders ...Finder) Finder {
|
||||
return &combinedFinder{finders: finders}
|
||||
}
|
||||
|
||||
// combinedFinder is a Finder that combines multiple finders.
|
||||
type combinedFinder struct {
|
||||
finders []Finder
|
||||
}
|
||||
|
||||
// Find implements the [Finder] interface.
|
||||
func (c *combinedFinder) Find(fsys afero.Fs) ([]string, error) {
|
||||
var results []string
|
||||
var errs []error
|
||||
|
||||
for _, finder := range c.finders {
|
||||
if finder == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
r, err := finder.Find(fsys)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
continue
|
||||
}
|
||||
|
||||
results = append(results, r...)
|
||||
}
|
||||
|
||||
return results, errors.Join(errs...)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue