We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, I am unable to Marshal (or Unmarshal) Duration fields whereas, GetDuration("fieldName") works
GetDuration("fieldName")
I've attached an simple test case
package main import ( "bytes" "testing" "time" "github.com/spf13/viper" ) func TestDurationConfig(t *testing.T) { type DurationConfig struct { testduration time.Duration } var testYaml = []byte(` TestDuration: 5ms `) viper.SetConfigType("yaml") viper.ReadConfig(bytes.NewBuffer(testYaml)) t.Logf("All keys: %#v", viper.AllSettings()) // this works if viper.GetDuration("testduration") != 5*time.Millisecond { t.Errorf("Duration is not 5ms - %v", viper.GetDuration("testduration")) } var config = &DurationConfig{} viper.Marshal(config) // this doesn't if config == nil || config.testduration != 5*time.Millisecond { t.Errorf("Duration config is not 5ms - %#v", config) } }
The text was updated successfully, but these errors were encountered:
Any chance to get this bug corrected?
Sorry, something went wrong.
+1
I've suggested fix: #205
e26d6ae
No branches or pull requests
Hi, I am unable to Marshal (or Unmarshal) Duration fields whereas,
GetDuration("fieldName")
worksI've attached an simple test case
The text was updated successfully, but these errors were encountered: