I build a go file using go build main.go
. But this program is using a ini file, how do I use this file cause when I run ./main
, I am getting this error:
2018/09/20 17:37:38 open config/config.ini: no such file or directory
2018/09/20 17:37:38 open config/config.ini: no such file or directory
panic: open config/config.ini: no such file or directory
goroutine 1 [running]:
log.Panic(0xc0000f7e98, 0x1, 0x1)
The code for using this file are:
func GetConfigFile() (*ini.File, error) {
f, err := ini.Load("config/config.ini")
if err != nil {
log.Println(err)
}
return f, err
}