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

监听文件变更,删除配置信息未改变 #152

Open
zuozhehao opened this issue Jul 6, 2023 · 6 comments
Open

监听文件变更,删除配置信息未改变 #152

zuozhehao opened this issue Jul 6, 2023 · 6 comments
Assignees
Labels
question Further information is requested

Comments

@zuozhehao
Copy link

test:
  data1:
    key: value
  data2:
    key: value

当删除一组配置信息的时

test:
  data1:
    key: value

监听到文件变更,cfg.Data()读出来的还是两组信息,data1和data2

@inhere inhere added the question Further information is requested label Jul 7, 2023
@inhere
Copy link
Member

inhere commented Jul 7, 2023

怎么删除的?给个简单的使用示例呢

@zuozhehao
Copy link
Author

zuozhehao commented Jul 7, 2023

怎么删除的?给个简单的使用示例呢

就我上面写的,原本有data1,data2启动后删除data2节点。

@inhere
Copy link
Member

inhere commented Jul 8, 2023

删除的配置文件里的 data2 吗?还是通过 cfg.Set 删除的。

@zuozhehao
Copy link
Author

删除的配置文件里的 data2 吗?还是通过 cfg.Set 删除的。

删除配置文件里的data2

@inhere
Copy link
Member

inhere commented Jul 12, 2023

config 不会主动监听文件变动,你是自己加的监听处理吗?

@zuozhehao
Copy link
Author

是的,根据这个来的。https://github.com/gookit/config/blob/master/_examples/watch_file.go

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

No branches or pull requests

2 participants