Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

viper监听配置文件修改的时候,变量读和写,在不同的线程,这里是否要加锁 #108

Open
1426919587 opened this issue Feb 29, 2024 · 0 comments

Comments

@1426919587
Copy link

viper.WatchConfig()
viper.OnConfigChange(func(e fsnotify.Event) {
            //写数据
	if err := viper.Unmarshal(config); err != nil {
		panic(err)
	}
})

}

func Get() Config {
//读数据
return *config
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant