summaryrefslogtreecommitdiff
path: root/vendor/github.com/spf13/viper/fs.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-01-17 14:54:30 +0000
committerLibravatar GitHub <noreply@github.com>2024-01-17 14:54:30 +0000
commit906639ad7eb92e9d631599f78979908930e59c84 (patch)
treedfef6d0a5ba47c49c214e4537a89dee6ad528df8 /vendor/github.com/spf13/viper/fs.go
parent[bugfix] Better Postgres search case insensitivity (#2526) (diff)
downloadgotosocial-906639ad7eb92e9d631599f78979908930e59c84.tar.xz
[chore] update viper version (#2539)
* update viper version * removes our last uses of the slice package * fix tests
Diffstat (limited to 'vendor/github.com/spf13/viper/fs.go')
-rw-r--r--vendor/github.com/spf13/viper/fs.go65
1 files changed, 0 insertions, 65 deletions
diff --git a/vendor/github.com/spf13/viper/fs.go b/vendor/github.com/spf13/viper/fs.go
deleted file mode 100644
index ecb1769e5..000000000
--- a/vendor/github.com/spf13/viper/fs.go
+++ /dev/null
@@ -1,65 +0,0 @@
-//go:build go1.16 && finder
-// +build go1.16,finder
-
-package viper
-
-import (
- "errors"
- "io/fs"
- "path"
-)
-
-type finder struct {
- paths []string
- fileNames []string
- extensions []string
-
- withoutExtension bool
-}
-
-func (f finder) Find(fsys fs.FS) (string, error) {
- for _, searchPath := range f.paths {
- for _, fileName := range f.fileNames {
- for _, extension := range f.extensions {
- filePath := path.Join(searchPath, fileName+"."+extension)
-
- ok, err := fileExists(fsys, filePath)
- if err != nil {
- return "", err
- }
-
- if ok {
- return filePath, nil
- }
- }
-
- if f.withoutExtension {
- filePath := path.Join(searchPath, fileName)
-
- ok, err := fileExists(fsys, filePath)
- if err != nil {
- return "", err
- }
-
- if ok {
- return filePath, nil
- }
- }
- }
- }
-
- return "", nil
-}
-
-func fileExists(fsys fs.FS, filePath string) (bool, error) {
- fileInfo, err := fs.Stat(fsys, filePath)
- if err == nil {
- return !fileInfo.IsDir(), nil
- }
-
- if errors.Is(err, fs.ErrNotExist) {
- return false, nil
- }
-
- return false, err
-}