From 64c980359aad6bd5f8a08fad6890f17b1f88c5f7 Mon Sep 17 00:00:00 2001 From: spags Date: Tue, 14 Oct 2025 14:02:27 -0700 Subject: [PATCH 1/2] Use interface StringReplacer instead of strings.Replacer --- viper.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/viper.go b/viper.go index 2d5158cbd..40cb71650 100644 --- a/viper.go +++ b/viper.go @@ -1451,15 +1451,15 @@ func (v *Viper) AutomaticEnv() { v.automaticEnvApplied = true } -// SetEnvKeyReplacer sets the strings.Replacer on the viper object +// SetEnvKeyReplacer sets the StringReplacer on the viper object // Useful for mapping an environmental variable to a key that does // not match it. -func SetEnvKeyReplacer(r *strings.Replacer) { v.SetEnvKeyReplacer(r) } +func SetEnvKeyReplacer(r *StringReplacer) { v.SetEnvKeyReplacer(r) } -// SetEnvKeyReplacer sets the strings.Replacer on the viper object +// SetEnvKeyReplacer sets the StringReplacer on the viper object // Useful for mapping an environmental variable to a key that does // not match it. -func (v *Viper) SetEnvKeyReplacer(r *strings.Replacer) { +func (v *Viper) SetEnvKeyReplacer(r *StringReplacer) { v.envKeyReplacer = r } From 0d61399c1438be5b979df1999f7f3fc05f7fe0c6 Mon Sep 17 00:00:00 2001 From: spags Date: Tue, 14 Oct 2025 14:03:10 -0700 Subject: [PATCH 2/2] Update viper.go --- viper.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/viper.go b/viper.go index 40cb71650..58855caa2 100644 --- a/viper.go +++ b/viper.go @@ -1454,12 +1454,12 @@ func (v *Viper) AutomaticEnv() { // SetEnvKeyReplacer sets the StringReplacer on the viper object // Useful for mapping an environmental variable to a key that does // not match it. -func SetEnvKeyReplacer(r *StringReplacer) { v.SetEnvKeyReplacer(r) } +func SetEnvKeyReplacer(r StringReplacer) { v.SetEnvKeyReplacer(r) } // SetEnvKeyReplacer sets the StringReplacer on the viper object // Useful for mapping an environmental variable to a key that does // not match it. -func (v *Viper) SetEnvKeyReplacer(r *StringReplacer) { +func (v *Viper) SetEnvKeyReplacer(r StringReplacer) { v.envKeyReplacer = r }