Add DocBlock to WatchConfig

Added a small description of the WatchConfig().
So that you can understand in the ide why you could use it.
This commit is contained in:
glebik000 2022-11-20 00:01:02 +10:00 committed by GitHub
parent b89e554a96
commit 3b18b32fd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -421,13 +421,18 @@ var SupportedExts = []string{"json", "toml", "yaml", "yml", "properties", "props
// SupportedRemoteProviders are universally supported remote providers.
var SupportedRemoteProviders = []string{"etcd", "etcd3", "consul", "firestore"}
// OnConfigChange is used to implement a response on config files change.
func OnConfigChange(run func(in fsnotify.Event)) { v.OnConfigChange(run) }
func (v *Viper) OnConfigChange(run func(in fsnotify.Event)) {
v.onConfigChange = run
}
// WatchConfig is watching changes on config files
// to start event in OnConfigChange. Used for global viper config.
func WatchConfig() { v.WatchConfig() }
// WatchConfig is watching changes on config files
// to start event in OnConfigChange.
func (v *Viper) WatchConfig() {
initWG := sync.WaitGroup{}
initWG.Add(1)