mirror of
https://github.com/spf13/viper
synced 2025-05-06 12:17:18 +00:00
Fix err variable in BindFlagValues
This commit is contained in:
parent
2e08d75548
commit
38bbed8820
1 changed files with 2 additions and 2 deletions
4
viper.go
4
viper.go
|
@ -687,10 +687,10 @@ func (v *Viper) BindPFlag(key string, flag *pflag.Flag) error {
|
||||||
// BindFlagValues binds a full FlagValue set to the configuration, using each flag's long
|
// BindFlagValues binds a full FlagValue set to the configuration, using each flag's long
|
||||||
// name as the config key.
|
// name as the config key.
|
||||||
func BindFlagValues(flags FlagValueSet) error { return v.BindFlagValues(flags) }
|
func BindFlagValues(flags FlagValueSet) error { return v.BindFlagValues(flags) }
|
||||||
func (v *Viper) BindFlagValues(flags FlagValueSet) error {
|
func (v *Viper) BindFlagValues(flags FlagValueSet) (err error) {
|
||||||
flags.VisitAll(func(flag FlagValue) {
|
flags.VisitAll(func(flag FlagValue) {
|
||||||
if err = v.BindFlagValue(flag.Name(), flag); err != nil {
|
if err = v.BindFlagValue(flag.Name(), flag); err != nil {
|
||||||
return err
|
return
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Add table
Reference in a new issue