mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-06-26 01:49:22 +00:00
Bump github.com/spf13/viper from 1.9.0 to 1.10.1 (#1684)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.9.0 to 1.10.1. - [Release notes](https://github.com/spf13/viper/releases) - [Commits](https://github.com/spf13/viper/compare/v1.9.0...v1.10.1) --- updated-dependencies: - dependency-name: github.com/spf13/viper dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
4
vendor/github.com/mitchellh/mapstructure/CHANGELOG.md
generated
vendored
4
vendor/github.com/mitchellh/mapstructure/CHANGELOG.md
generated
vendored
@ -1,3 +1,7 @@
|
||||
## 1.4.3
|
||||
|
||||
* Fix cases where `json.Number` didn't decode properly [GH-261]
|
||||
|
||||
## 1.4.2
|
||||
|
||||
* Custom name matchers to support any sort of casing, formatting, etc. for
|
||||
|
8
vendor/github.com/mitchellh/mapstructure/mapstructure.go
generated
vendored
8
vendor/github.com/mitchellh/mapstructure/mapstructure.go
generated
vendored
@ -684,16 +684,12 @@ func (d *Decoder) decodeUint(name string, data interface{}, val reflect.Value) e
|
||||
}
|
||||
case dataType.PkgPath() == "encoding/json" && dataType.Name() == "Number":
|
||||
jn := data.(json.Number)
|
||||
i, err := jn.Int64()
|
||||
i, err := strconv.ParseUint(string(jn), 0, 64)
|
||||
if err != nil {
|
||||
return fmt.Errorf(
|
||||
"error decoding json.Number into %s: %s", name, err)
|
||||
}
|
||||
if i < 0 && !d.config.WeaklyTypedInput {
|
||||
return fmt.Errorf("cannot parse '%s', %d overflows uint",
|
||||
name, i)
|
||||
}
|
||||
val.SetUint(uint64(i))
|
||||
val.SetUint(i)
|
||||
default:
|
||||
return fmt.Errorf(
|
||||
"'%s' expected type '%s', got unconvertible type '%s', value: '%v'",
|
||||
|
2
vendor/github.com/spf13/viper/.golangci.yml
generated
vendored
2
vendor/github.com/spf13/viper/.golangci.yml
generated
vendored
@ -20,7 +20,6 @@ linters:
|
||||
- exhaustive
|
||||
- exportloopref
|
||||
- gci
|
||||
- goconst
|
||||
- gofmt
|
||||
- gofumpt
|
||||
- goimports
|
||||
@ -62,6 +61,7 @@ linters:
|
||||
# - gochecknoglobals
|
||||
# - gochecknoinits
|
||||
# - gocognit
|
||||
# - goconst
|
||||
# - gocritic
|
||||
# - gocyclo
|
||||
# - godot
|
||||
|
4
vendor/github.com/spf13/viper/Makefile
generated
vendored
4
vendor/github.com/spf13/viper/Makefile
generated
vendored
@ -15,8 +15,8 @@ TEST_FORMAT = short-verbose
|
||||
endif
|
||||
|
||||
# Dependency versions
|
||||
GOTESTSUM_VERSION = 1.6.4
|
||||
GOLANGCI_VERSION = 1.40.1
|
||||
GOTESTSUM_VERSION = 1.7.0
|
||||
GOLANGCI_VERSION = 1.43.0
|
||||
|
||||
# Add the ability to override some variables
|
||||
# Use with care
|
||||
|
65
vendor/github.com/spf13/viper/fs.go
generated
vendored
Normal file
65
vendor/github.com/spf13/viper/fs.go
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
//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
|
||||
}
|
77
vendor/github.com/spf13/viper/logger.go
generated
vendored
Normal file
77
vendor/github.com/spf13/viper/logger.go
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
package viper
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
jww "github.com/spf13/jwalterweatherman"
|
||||
)
|
||||
|
||||
// Logger is a unified interface for various logging use cases and practices, including:
|
||||
// - leveled logging
|
||||
// - structured logging
|
||||
type Logger interface {
|
||||
// Trace logs a Trace event.
|
||||
//
|
||||
// Even more fine-grained information than Debug events.
|
||||
// Loggers not supporting this level should fall back to Debug.
|
||||
Trace(msg string, keyvals ...interface{})
|
||||
|
||||
// Debug logs a Debug event.
|
||||
//
|
||||
// A verbose series of information events.
|
||||
// They are useful when debugging the system.
|
||||
Debug(msg string, keyvals ...interface{})
|
||||
|
||||
// Info logs an Info event.
|
||||
//
|
||||
// General information about what's happening inside the system.
|
||||
Info(msg string, keyvals ...interface{})
|
||||
|
||||
// Warn logs a Warn(ing) event.
|
||||
//
|
||||
// Non-critical events that should be looked at.
|
||||
Warn(msg string, keyvals ...interface{})
|
||||
|
||||
// Error logs an Error event.
|
||||
//
|
||||
// Critical events that require immediate attention.
|
||||
// Loggers commonly provide Fatal and Panic levels above Error level,
|
||||
// but exiting and panicing is out of scope for a logging library.
|
||||
Error(msg string, keyvals ...interface{})
|
||||
}
|
||||
|
||||
type jwwLogger struct{}
|
||||
|
||||
func (jwwLogger) Trace(msg string, keyvals ...interface{}) {
|
||||
jww.TRACE.Printf(jwwLogMessage(msg, keyvals...))
|
||||
}
|
||||
|
||||
func (jwwLogger) Debug(msg string, keyvals ...interface{}) {
|
||||
jww.DEBUG.Printf(jwwLogMessage(msg, keyvals...))
|
||||
}
|
||||
|
||||
func (jwwLogger) Info(msg string, keyvals ...interface{}) {
|
||||
jww.INFO.Printf(jwwLogMessage(msg, keyvals...))
|
||||
}
|
||||
|
||||
func (jwwLogger) Warn(msg string, keyvals ...interface{}) {
|
||||
jww.WARN.Printf(jwwLogMessage(msg, keyvals...))
|
||||
}
|
||||
|
||||
func (jwwLogger) Error(msg string, keyvals ...interface{}) {
|
||||
jww.ERROR.Printf(jwwLogMessage(msg, keyvals...))
|
||||
}
|
||||
|
||||
func jwwLogMessage(msg string, keyvals ...interface{}) string {
|
||||
out := msg
|
||||
|
||||
if len(keyvals) > 0 && len(keyvals)%2 == 1 {
|
||||
keyvals = append(keyvals, nil)
|
||||
}
|
||||
|
||||
for i := 0; i <= len(keyvals)-2; i += 2 {
|
||||
out = fmt.Sprintf("%s %v=%v", out, keyvals[i], keyvals[i+1])
|
||||
}
|
||||
|
||||
return out
|
||||
}
|
22
vendor/github.com/spf13/viper/util.go
generated
vendored
22
vendor/github.com/spf13/viper/util.go
generated
vendored
@ -18,9 +18,7 @@ import (
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
"github.com/spf13/cast"
|
||||
jww "github.com/spf13/jwalterweatherman"
|
||||
)
|
||||
|
||||
// ConfigParseError denotes failing to parse configuration file.
|
||||
@ -88,8 +86,8 @@ func insensitiviseMap(m map[string]interface{}) {
|
||||
}
|
||||
}
|
||||
|
||||
func absPathify(inPath string) string {
|
||||
jww.INFO.Println("Trying to resolve absolute path to", inPath)
|
||||
func absPathify(logger Logger, inPath string) string {
|
||||
logger.Info("trying to resolve absolute path", "path", inPath)
|
||||
|
||||
if inPath == "$HOME" || strings.HasPrefix(inPath, "$HOME"+string(os.PathSeparator)) {
|
||||
inPath = userHomeDir() + inPath[5:]
|
||||
@ -106,21 +104,9 @@ func absPathify(inPath string) string {
|
||||
return filepath.Clean(p)
|
||||
}
|
||||
|
||||
jww.ERROR.Println("Couldn't discover absolute path")
|
||||
jww.ERROR.Println(err)
|
||||
return ""
|
||||
}
|
||||
logger.Error(fmt.Errorf("could not discover absolute path: %w", err).Error())
|
||||
|
||||
// Check if file Exists
|
||||
func exists(fs afero.Fs, path string) (bool, error) {
|
||||
stat, err := fs.Stat(path)
|
||||
if err == nil {
|
||||
return !stat.IsDir(), nil
|
||||
}
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
return ""
|
||||
}
|
||||
|
||||
func stringInSlice(a string, list []string) bool {
|
||||
|
97
vendor/github.com/spf13/viper/viper.go
generated
vendored
97
vendor/github.com/spf13/viper/viper.go
generated
vendored
@ -39,7 +39,6 @@ import (
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/spf13/afero"
|
||||
"github.com/spf13/cast"
|
||||
jww "github.com/spf13/jwalterweatherman"
|
||||
"github.com/spf13/pflag"
|
||||
"github.com/subosito/gotenv"
|
||||
"gopkg.in/ini.v1"
|
||||
@ -260,6 +259,8 @@ type Viper struct {
|
||||
properties *properties.Properties
|
||||
|
||||
onConfigChange func(fsnotify.Event)
|
||||
|
||||
logger Logger
|
||||
}
|
||||
|
||||
// New returns an initialized Viper instance.
|
||||
@ -267,7 +268,7 @@ func New() *Viper {
|
||||
v := new(Viper)
|
||||
v.keyDelim = "."
|
||||
v.configName = "config"
|
||||
v.configPermissions = os.FileMode(0644)
|
||||
v.configPermissions = os.FileMode(0o644)
|
||||
v.fs = afero.NewOsFs()
|
||||
v.config = make(map[string]interface{})
|
||||
v.override = make(map[string]interface{})
|
||||
@ -277,6 +278,7 @@ func New() *Viper {
|
||||
v.env = make(map[string][]string)
|
||||
v.aliases = make(map[string]string)
|
||||
v.typeByDefValue = false
|
||||
v.logger = jwwLogger{}
|
||||
|
||||
return v
|
||||
}
|
||||
@ -517,8 +519,9 @@ func AddConfigPath(in string) { v.AddConfigPath(in) }
|
||||
|
||||
func (v *Viper) AddConfigPath(in string) {
|
||||
if in != "" {
|
||||
absin := absPathify(in)
|
||||
jww.INFO.Println("adding", absin, "to paths to search")
|
||||
absin := absPathify(v.logger, in)
|
||||
|
||||
v.logger.Info("adding path to search paths", "path", absin)
|
||||
if !stringInSlice(absin, v.configPaths) {
|
||||
v.configPaths = append(v.configPaths, absin)
|
||||
}
|
||||
@ -542,7 +545,8 @@ func (v *Viper) AddRemoteProvider(provider, endpoint, path string) error {
|
||||
return UnsupportedRemoteProviderError(provider)
|
||||
}
|
||||
if provider != "" && endpoint != "" {
|
||||
jww.INFO.Printf("adding %s:%s to remote provider list", provider, endpoint)
|
||||
v.logger.Info("adding remote provider", "provider", provider, "endpoint", endpoint)
|
||||
|
||||
rp := &defaultRemoteProvider{
|
||||
endpoint: endpoint,
|
||||
provider: provider,
|
||||
@ -574,7 +578,8 @@ func (v *Viper) AddSecureRemoteProvider(provider, endpoint, path, secretkeyring
|
||||
return UnsupportedRemoteProviderError(provider)
|
||||
}
|
||||
if provider != "" && endpoint != "" {
|
||||
jww.INFO.Printf("adding %s:%s to remote provider list", provider, endpoint)
|
||||
v.logger.Info("adding remote provider", "provider", provider, "endpoint", endpoint)
|
||||
|
||||
rp := &defaultRemoteProvider{
|
||||
endpoint: endpoint,
|
||||
provider: provider,
|
||||
@ -1390,14 +1395,15 @@ func (v *Viper) registerAlias(alias string, key string) {
|
||||
v.aliases[alias] = key
|
||||
}
|
||||
} else {
|
||||
jww.WARN.Println("Creating circular reference alias", alias, key, v.realKey(key))
|
||||
v.logger.Warn("creating circular reference alias", "alias", alias, "key", key, "real_key", v.realKey(key))
|
||||
}
|
||||
}
|
||||
|
||||
func (v *Viper) realKey(key string) string {
|
||||
newkey, exists := v.aliases[key]
|
||||
if exists {
|
||||
jww.DEBUG.Println("Alias", key, "to", newkey)
|
||||
v.logger.Debug("key is an alias", "alias", key, "to", newkey)
|
||||
|
||||
return v.realKey(newkey)
|
||||
}
|
||||
return key
|
||||
@ -1458,7 +1464,7 @@ func (v *Viper) Set(key string, value interface{}) {
|
||||
func ReadInConfig() error { return v.ReadInConfig() }
|
||||
|
||||
func (v *Viper) ReadInConfig() error {
|
||||
jww.INFO.Println("Attempting to read in config file")
|
||||
v.logger.Info("attempting to read in config file")
|
||||
filename, err := v.getConfigFile()
|
||||
if err != nil {
|
||||
return err
|
||||
@ -1468,7 +1474,7 @@ func (v *Viper) ReadInConfig() error {
|
||||
return UnsupportedConfigError(v.getConfigType())
|
||||
}
|
||||
|
||||
jww.DEBUG.Println("Reading file: ", filename)
|
||||
v.logger.Debug("reading file", "file", filename)
|
||||
file, err := afero.ReadFile(v.fs, filename)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -1489,7 +1495,7 @@ func (v *Viper) ReadInConfig() error {
|
||||
func MergeInConfig() error { return v.MergeInConfig() }
|
||||
|
||||
func (v *Viper) MergeInConfig() error {
|
||||
jww.INFO.Println("Attempting to merge in config file")
|
||||
v.logger.Info("attempting to merge in config file")
|
||||
filename, err := v.getConfigFile()
|
||||
if err != nil {
|
||||
return err
|
||||
@ -1580,7 +1586,8 @@ func (v *Viper) SafeWriteConfigAs(filename string) error {
|
||||
}
|
||||
|
||||
func (v *Viper) writeConfig(filename string, force bool) error {
|
||||
jww.INFO.Println("Attempting to write configuration to file.")
|
||||
v.logger.Info("attempting to write configuration to file")
|
||||
|
||||
var configType string
|
||||
|
||||
ext := filepath.Ext(filename)
|
||||
@ -1796,7 +1803,7 @@ func mergeMaps(
|
||||
for sk, sv := range src {
|
||||
tk := keyExists(sk, tgt)
|
||||
if tk == "" {
|
||||
jww.TRACE.Printf("tk=\"\", tgt[%s]=%v", sk, sv)
|
||||
v.logger.Trace("", "tk", "\"\"", fmt.Sprintf("tgt[%s]", sk), sv)
|
||||
tgt[sk] = sv
|
||||
if itgt != nil {
|
||||
itgt[sk] = sv
|
||||
@ -1806,7 +1813,7 @@ func mergeMaps(
|
||||
|
||||
tv, ok := tgt[tk]
|
||||
if !ok {
|
||||
jww.TRACE.Printf("tgt[%s] != ok, tgt[%s]=%v", tk, sk, sv)
|
||||
v.logger.Trace("", fmt.Sprintf("ok[%s]", tk), false, fmt.Sprintf("tgt[%s]", sk), sv)
|
||||
tgt[sk] = sv
|
||||
if itgt != nil {
|
||||
itgt[sk] = sv
|
||||
@ -1817,27 +1824,38 @@ func mergeMaps(
|
||||
svType := reflect.TypeOf(sv)
|
||||
tvType := reflect.TypeOf(tv)
|
||||
if tvType != nil && svType != tvType { // Allow for the target to be nil
|
||||
jww.ERROR.Printf(
|
||||
"svType != tvType; key=%s, st=%v, tt=%v, sv=%v, tv=%v",
|
||||
sk, svType, tvType, sv, tv)
|
||||
v.logger.Error(
|
||||
"svType != tvType",
|
||||
"key", sk,
|
||||
"st", svType,
|
||||
"tt", tvType,
|
||||
"sv", sv,
|
||||
"tv", tv,
|
||||
)
|
||||
continue
|
||||
}
|
||||
|
||||
jww.TRACE.Printf("processing key=%s, st=%v, tt=%v, sv=%v, tv=%v",
|
||||
sk, svType, tvType, sv, tv)
|
||||
v.logger.Trace(
|
||||
"processing",
|
||||
"key", sk,
|
||||
"st", svType,
|
||||
"tt", tvType,
|
||||
"sv", sv,
|
||||
"tv", tv,
|
||||
)
|
||||
|
||||
switch ttv := tv.(type) {
|
||||
case map[interface{}]interface{}:
|
||||
jww.TRACE.Printf("merging maps (must convert)")
|
||||
v.logger.Trace("merging maps (must convert)")
|
||||
tsv := sv.(map[interface{}]interface{})
|
||||
ssv := castToMapStringInterface(tsv)
|
||||
stv := castToMapStringInterface(ttv)
|
||||
mergeMaps(ssv, stv, ttv)
|
||||
case map[string]interface{}:
|
||||
jww.TRACE.Printf("merging maps")
|
||||
v.logger.Trace("merging maps")
|
||||
mergeMaps(sv.(map[string]interface{}), ttv, nil)
|
||||
default:
|
||||
jww.TRACE.Printf("setting value")
|
||||
v.logger.Trace("setting value")
|
||||
tgt[tk] = sv
|
||||
if itgt != nil {
|
||||
itgt[tk] = sv
|
||||
@ -1872,7 +1890,7 @@ func (v *Viper) getKeyValueConfig() error {
|
||||
for _, rp := range v.remoteProviders {
|
||||
val, err := v.getRemoteConfig(rp)
|
||||
if err != nil {
|
||||
jww.ERROR.Printf("get remote config: %s", err)
|
||||
v.logger.Error(fmt.Errorf("get remote config: %w", err).Error())
|
||||
|
||||
continue
|
||||
}
|
||||
@ -2108,39 +2126,6 @@ func (v *Viper) getConfigFile() (string, error) {
|
||||
return v.configFile, nil
|
||||
}
|
||||
|
||||
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(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)
|
||||
}
|
||||
}
|
||||
|
||||
if v.configType != "" {
|
||||
if b, _ := exists(v.fs, filepath.Join(in, v.configName)); b {
|
||||
return filepath.Join(in, v.configName)
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// Search all configPaths for any config file.
|
||||
// Returns the first path that exists (and is a config file).
|
||||
func (v *Viper) findConfigFile() (string, error) {
|
||||
jww.INFO.Println("Searching for config in ", v.configPaths)
|
||||
|
||||
for _, cp := range v.configPaths {
|
||||
file := v.searchInPath(cp)
|
||||
if file != "" {
|
||||
return file, nil
|
||||
}
|
||||
}
|
||||
return "", ConfigFileNotFoundError{v.configName, fmt.Sprintf("%s", v.configPaths)}
|
||||
}
|
||||
|
||||
// Debug prints all configuration registries for debugging
|
||||
// purposes.
|
||||
func Debug() { v.Debug() }
|
||||
|
57
vendor/github.com/spf13/viper/viper_go1_15.go
generated
vendored
Normal file
57
vendor/github.com/spf13/viper/viper_go1_15.go
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
//go:build !go1.16 || !finder
|
||||
// +build !go1.16 !finder
|
||||
|
||||
package viper
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
)
|
||||
|
||||
// Search all configPaths for any config file.
|
||||
// Returns the first path that exists (and is a config file).
|
||||
func (v *Viper) findConfigFile() (string, error) {
|
||||
v.logger.Info("searching for config in paths", "paths", v.configPaths)
|
||||
|
||||
for _, cp := range v.configPaths {
|
||||
file := v.searchInPath(cp)
|
||||
if file != "" {
|
||||
return file, nil
|
||||
}
|
||||
}
|
||||
return "", ConfigFileNotFoundError{v.configName, fmt.Sprintf("%s", v.configPaths)}
|
||||
}
|
||||
|
||||
func (v *Viper) searchInPath(in string) (filename string) {
|
||||
v.logger.Debug("searching for config in path", "path", in)
|
||||
for _, ext := range SupportedExts {
|
||||
v.logger.Debug("checking if file exists", "file", filepath.Join(in, v.configName+"."+ext))
|
||||
if b, _ := exists(v.fs, filepath.Join(in, v.configName+"."+ext)); b {
|
||||
v.logger.Debug("found file", "file", filepath.Join(in, v.configName+"."+ext))
|
||||
return filepath.Join(in, v.configName+"."+ext)
|
||||
}
|
||||
}
|
||||
|
||||
if v.configType != "" {
|
||||
if b, _ := exists(v.fs, filepath.Join(in, v.configName)); b {
|
||||
return filepath.Join(in, v.configName)
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// Check if file Exists
|
||||
func exists(fs afero.Fs, path string) (bool, error) {
|
||||
stat, err := fs.Stat(path)
|
||||
if err == nil {
|
||||
return !stat.IsDir(), nil
|
||||
}
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
32
vendor/github.com/spf13/viper/viper_go1_16.go
generated
vendored
Normal file
32
vendor/github.com/spf13/viper/viper_go1_16.go
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
//go:build go1.16 && finder
|
||||
// +build go1.16,finder
|
||||
|
||||
package viper
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
)
|
||||
|
||||
// Search all configPaths for any config file.
|
||||
// Returns the first path that exists (and is a config file).
|
||||
func (v *Viper) findConfigFile() (string, error) {
|
||||
finder := finder{
|
||||
paths: v.configPaths,
|
||||
fileNames: []string{v.configName},
|
||||
extensions: SupportedExts,
|
||||
withoutExtension: v.configType != "",
|
||||
}
|
||||
|
||||
file, err := finder.Find(afero.NewIOFS(v.fs))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if file == "" {
|
||||
return "", ConfigFileNotFoundError{v.configName, fmt.Sprintf("%s", v.configPaths)}
|
||||
}
|
||||
|
||||
return file, nil
|
||||
}
|
1
vendor/github.com/spf13/viper/watch.go
generated
vendored
1
vendor/github.com/spf13/viper/watch.go
generated
vendored
@ -1,3 +1,4 @@
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package viper
|
||||
|
6
vendor/gopkg.in/ini.v1/file.go
generated
vendored
6
vendor/gopkg.in/ini.v1/file.go
generated
vendored
@ -142,6 +142,12 @@ func (f *File) GetSection(name string) (*Section, error) {
|
||||
return secs[0], err
|
||||
}
|
||||
|
||||
// HasSection returns true if the file contains a section with given name.
|
||||
func (f *File) HasSection(name string) bool {
|
||||
section, _ := f.GetSection(name)
|
||||
return section != nil
|
||||
}
|
||||
|
||||
// SectionsByName returns all sections with given name.
|
||||
func (f *File) SectionsByName(name string) ([]*Section, error) {
|
||||
if len(name) == 0 {
|
||||
|
26
vendor/gopkg.in/ini.v1/parser.go
generated
vendored
26
vendor/gopkg.in/ini.v1/parser.go
generated
vendored
@ -302,15 +302,9 @@ func (p *parser) readPythonMultilines(line string, bufferSize int) (string, erro
|
||||
parserBufferPeekResult, _ := p.buf.Peek(bufferSize)
|
||||
peekBuffer := bytes.NewBuffer(parserBufferPeekResult)
|
||||
|
||||
indentSize := 0
|
||||
for {
|
||||
peekData, peekErr := peekBuffer.ReadBytes('\n')
|
||||
if peekErr != nil {
|
||||
if peekErr == io.EOF {
|
||||
p.debug("readPythonMultilines: io.EOF, peekData: %q, line: %q", string(peekData), line)
|
||||
return line, nil
|
||||
}
|
||||
|
||||
if peekErr != nil && peekErr != io.EOF {
|
||||
p.debug("readPythonMultilines: failed to peek with error: %v", peekErr)
|
||||
return "", peekErr
|
||||
}
|
||||
@ -329,19 +323,6 @@ func (p *parser) readPythonMultilines(line string, bufferSize int) (string, erro
|
||||
return line, nil
|
||||
}
|
||||
|
||||
// Determine indent size and line prefix.
|
||||
currentIndentSize := len(peekMatches[1])
|
||||
if indentSize < 1 {
|
||||
indentSize = currentIndentSize
|
||||
p.debug("readPythonMultilines: indent size is %d", indentSize)
|
||||
}
|
||||
|
||||
// Make sure each line is indented at least as far as first line.
|
||||
if currentIndentSize < indentSize {
|
||||
p.debug("readPythonMultilines: end of value, current indent: %d, expected indent: %d, line: %q", currentIndentSize, indentSize, line)
|
||||
return line, nil
|
||||
}
|
||||
|
||||
// Advance the parser reader (buffer) in-sync with the peek buffer.
|
||||
_, err := p.buf.Discard(len(peekData))
|
||||
if err != nil {
|
||||
@ -349,8 +330,7 @@ func (p *parser) readPythonMultilines(line string, bufferSize int) (string, erro
|
||||
return "", err
|
||||
}
|
||||
|
||||
// Handle indented empty line.
|
||||
line += "\n" + peekMatches[1][indentSize:] + peekMatches[2]
|
||||
line += "\n" + peekMatches[0]
|
||||
}
|
||||
}
|
||||
|
||||
@ -461,6 +441,8 @@ func (f *File) parse(reader io.Reader) (err error) {
|
||||
// Reset auto-counter and comments
|
||||
p.comment.Reset()
|
||||
p.count = 1
|
||||
// Nested values can't span sections
|
||||
isLastValueEmpty = false
|
||||
|
||||
inUnparseableSection = false
|
||||
for i := range f.options.UnparseableSections {
|
||||
|
8
vendor/modules.txt
vendored
8
vendor/modules.txt
vendored
@ -281,7 +281,7 @@ github.com/missdeer/golib/ic
|
||||
# github.com/mitchellh/go-homedir v1.1.0
|
||||
## explicit
|
||||
github.com/mitchellh/go-homedir
|
||||
# github.com/mitchellh/mapstructure v1.4.2
|
||||
# github.com/mitchellh/mapstructure v1.4.3
|
||||
## explicit; go 1.14
|
||||
github.com/mitchellh/mapstructure
|
||||
# github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
|
||||
@ -379,8 +379,8 @@ github.com/spf13/jwalterweatherman
|
||||
# github.com/spf13/pflag v1.0.5
|
||||
## explicit; go 1.12
|
||||
github.com/spf13/pflag
|
||||
# github.com/spf13/viper v1.9.0
|
||||
## explicit; go 1.12
|
||||
# github.com/spf13/viper v1.10.1
|
||||
## explicit; go 1.17
|
||||
github.com/spf13/viper
|
||||
github.com/spf13/viper/internal/encoding
|
||||
github.com/spf13/viper/internal/encoding/hcl
|
||||
@ -577,7 +577,7 @@ google.golang.org/protobuf/reflect/protoregistry
|
||||
google.golang.org/protobuf/runtime/protoiface
|
||||
google.golang.org/protobuf/runtime/protoimpl
|
||||
google.golang.org/protobuf/types/descriptorpb
|
||||
# gopkg.in/ini.v1 v1.64.0
|
||||
# gopkg.in/ini.v1 v1.66.2
|
||||
## explicit
|
||||
gopkg.in/ini.v1
|
||||
# gopkg.in/natefinch/lumberjack.v2 v2.0.0
|
||||
|
Reference in New Issue
Block a user