From 69647fb42256db99f5b51b9ffa4a423ce2d38aba Mon Sep 17 00:00:00 2001 From: Benoit Masson Date: Mon, 17 Apr 2017 18:52:25 +0200 Subject: [PATCH] Fixed TestBindPFlagsStringSlice() Replaced Visit() by VisitAll(), so that the Changed attribute of the updated flag is correctly set. --- viper_test.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/viper_test.go b/viper_test.go index d5c637dba..21b49c90a 100644 --- a/viper_test.go +++ b/viper_test.go @@ -630,11 +630,9 @@ func TestBindPFlagsStringSlice(t *testing.T) { flagSet := pflag.NewFlagSet("test", pflag.ContinueOnError) flagSet.StringSlice("stringslice", testValue.Expected, "test") - flagSet.Visit(func(f *pflag.Flag) { - if len(testValue.Value) > 0 { - f.Value.Set(testValue.Value) - f.Changed = changed - } + flagSet.VisitAll(func(f *pflag.Flag) { + f.Value.Set(testValue.Value) + f.Changed = changed }) err := v.BindPFlags(flagSet)