From fb4eafdd9775508c450b90b1b72affeef4a68cf5 Mon Sep 17 00:00:00 2001 From: r-stepanenko <72788745+r-stepanenko@users.noreply.github.com> Date: Wed, 10 Mar 2021 16:46:19 +0300 Subject: [PATCH] fix INI saving panics (#1075) --- viper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/viper.go b/viper.go index 7027715..6d149f6 100644 --- a/viper.go +++ b/viper.go @@ -1743,7 +1743,7 @@ func (v *Viper) marshalWriter(f afero.File, configType string) error { if sectionName == "default" { sectionName = "" } - cfg.Section(sectionName).Key(keyName).SetValue(v.Get(key).(string)) + cfg.Section(sectionName).Key(keyName).SetValue(v.GetString(key)) } cfg.WriteTo(f) }