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("程序已正常运行...") }