During write unit test with beego , source code contains beego.AppConfig.GetSection()
appear the bug .
I can not right get the config. code in project like this
cfgs, err := beego.AppConfig.GetSection("test_conf")
if err != nil {
panic(err)
}
panic outputs: not implement in the fakeConfigContainer
beego’s author reply in github that is a bug and already fixed in new version, but i got this problem still now with version 1.11.1
.
Many guys have the same problem , when I search solutions in github.
I find a solution not the best.
add this code to init method above
beego.AppConfig.GetSection()
.
err := beego.LoadAppConfig("ini", "../conf/app.conf")
if err != nil {
panic(err)
}
cfgs, err := beego.AppConfig.GetSection("test_conf")
if err != nil {
panic(err)
}