From 591241a57f468a8707e3eabe5ac046a5ed3fb23d Mon Sep 17 00:00:00 2001 From: yinpeng Date: Tue, 30 Apr 2024 19:10:35 +0800 Subject: [PATCH] fix: typo --- README.md | 8 ++++---- TROUBLESHOOTING.md | 4 ++-- remote/remote.go | 6 +++--- viper_test.go | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 453ecca..5eb90c4 100644 --- a/README.md +++ b/README.md @@ -718,9 +718,9 @@ The resulting code is easy to test, since it's decoupled from the main config st and easier to reuse (for the same reason). -### Unmarshaling +### Unmarshalling -You also have the option of Unmarshaling all or a specific value to a struct, map, +You also have the option of Unmarshalling all or a specific value to a struct, map, etc. There are two methods to do this: @@ -771,7 +771,7 @@ var C config v.Unmarshal(&C) ``` -Viper also supports unmarshaling into embedded structs: +Viper also supports unmarshalling into embedded structs: ```go /* @@ -802,7 +802,7 @@ if err != nil { } ``` -Viper uses [github.com/mitchellh/mapstructure](https://github.com/mitchellh/mapstructure) under the hood for unmarshaling values which uses `mapstructure` tags by default. +Viper uses [github.com/mitchellh/mapstructure](https://github.com/mitchellh/mapstructure) under the hood for unmarshalling values which uses `mapstructure` tags by default. ### Decoding custom formats diff --git a/TROUBLESHOOTING.md b/TROUBLESHOOTING.md index b68993d..322a70d 100644 --- a/TROUBLESHOOTING.md +++ b/TROUBLESHOOTING.md @@ -1,8 +1,8 @@ # Troubleshooting -## Unmarshaling doesn't work +## Unmarshalling doesn't work -The most common reason for this issue is improper use of struct tags (eg. `yaml` or `json`). Viper uses [github.com/mitchellh/mapstructure](https://github.com/mitchellh/mapstructure) under the hood for unmarshaling values which uses `mapstructure` tags by default. Please refer to the library's documentation for using other struct tags. +The most common reason for this issue is improper use of struct tags (eg. `yaml` or `json`). Viper uses [github.com/mitchellh/mapstructure](https://github.com/mitchellh/mapstructure) under the hood for unmarshalling values which uses `mapstructure` tags by default. Please refer to the library's documentation for using other struct tags. ## Cannot find package diff --git a/remote/remote.go b/remote/remote.go index d61f880..5ba9160 100644 --- a/remote/remote.go +++ b/remote/remote.go @@ -51,7 +51,7 @@ func (rc remoteConfigProvider) WatchChannel(rp viper.RemoteProvider) (<-chan *vi } quit := make(chan bool) quitwc := make(chan bool) - viperResponsCh := make(chan *viper.RemoteResponse) + viperResponseCh := make(chan *viper.RemoteResponse) cryptoResponseCh := cm.Watch(rp.Path(), quit) // need this function to convert the Channel response form crypt.Response to viper.Response go func(cr <-chan *crypt.Response, vr chan<- *viper.RemoteResponse, quitwc <-chan bool, quit chan<- bool) { @@ -67,9 +67,9 @@ func (rc remoteConfigProvider) WatchChannel(rp viper.RemoteProvider) (<-chan *vi } } } - }(cryptoResponseCh, viperResponsCh, quitwc, quit) + }(cryptoResponseCh, viperResponseCh, quitwc, quit) - return viperResponsCh, quitwc + return viperResponseCh, quitwc } func getConfigManager(rp viper.RemoteProvider) (crypt.ConfigManager, error) { diff --git a/viper_test.go b/viper_test.go index f5ac1be..b12c813 100644 --- a/viper_test.go +++ b/viper_test.go @@ -432,7 +432,7 @@ func TestDefault(t *testing.T) { assert.Equal(t, "leather", v.Get("clothing.jacket")) } -func TestUnmarshaling(t *testing.T) { +func TestUnmarshalling(t *testing.T) { v := New() v.SetConfigType("yaml") r := bytes.NewReader(yamlExample) @@ -2191,7 +2191,7 @@ func TestMergeConfigMap(t *testing.T) { assertFn(1234) } -func TestUnmarshalingWithAliases(t *testing.T) { +func TestUnmarshallingWithAliases(t *testing.T) { v := New() v.SetDefault("ID", 1) v.Set("name", "Steve")