You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
582 B
35 lines
582 B
2 years ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"expenses/common/config"
|
||
|
"expenses/common/db"
|
||
|
"expenses/common/log"
|
||
|
"expenses/global"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
/*日志初始化*/
|
||
|
log.Init()
|
||
|
|
||
|
/*配置文件初始化*/
|
||
|
conf, err := config.ConfigInit()
|
||
|
if err != nil {
|
||
|
log.Log.Printf("加载配置文件失败!")
|
||
|
os.Exit(-1)
|
||
|
}
|
||
|
|
||
|
/*数据库初始化*/
|
||
|
initDB, err := db.InitDB(conf.DataSource)
|
||
|
if err != nil {
|
||
|
log.Log.Printf("数据库初始化失败!")
|
||
|
os.Exit(-2)
|
||
|
}
|
||
|
|
||
|
/*全局变量初始化*/
|
||
|
global.GLO_CONF = conf
|
||
|
global.GLO_DB = initDB
|
||
|
|
||
|
log.Log.Printf("程序已正常运行...")
|
||
|
}
|