Merge pull request #1 from lianxmfor/lianxmfor-patch-1

update readme.md
This commit is contained in:
连修明 2021-08-30 14:49:20 +08:00 committed by GitHub
commit 098d694990
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -175,10 +175,10 @@ Optionally you can provide a function for Viper to run each time a change occurs
**Make sure you add all of the configPaths prior to calling `WatchConfig()`** **Make sure you add all of the configPaths prior to calling `WatchConfig()`**
```go ```go
viper.WatchConfig()
viper.OnConfigChange(func(e fsnotify.Event) { viper.OnConfigChange(func(e fsnotify.Event) {
fmt.Println("Config file changed:", e.Name) fmt.Println("Config file changed:", e.Name)
}) })
viper.WatchConfig()
``` ```
### Reading Config from io.Reader ### Reading Config from io.Reader