package main import ( "mtp20access/core" "mtp20access/global" "mtp20access/initialize" "go.uber.org/zap" ) func main() { // 初始化Viper global.M2A_VP = core.Viper() // 初始化zap日志库 global.M2A_LOG = core.Zap() zap.ReplaceGlobals(global.M2A_LOG) // xorm连接数据库 global.M2A_DB = initialize.XormOracle() if global.M2A_DB != nil { // 程序结束前关闭数据库链接 defer global.M2A_DB.DB().Close() } else { return } // 连接RabbitMQ global.M2A_RABBITMQ = initialize.RabbitMQ() if global.M2A_RABBITMQ != nil { defer global.M2A_RABBITMQ.Connection.Close() } else { return } // 启动服务 core.RunServer() defer global.M2A_REDIS.Close() }