Use go mod to manage the packages.

This commit is contained in:
zicla
2019-04-26 20:05:50 +08:00
parent c251ed9f1b
commit 0f45799fee
3 changed files with 218 additions and 1 deletions

35
main.go Normal file
View File

@ -0,0 +1,35 @@
package tank
import (
"fmt"
"github.com/eyebluecn/tank/code/config"
"github.com/eyebluecn/tank/code/logger"
"github.com/eyebluecn/tank/code/rest"
_ "github.com/go-sql-driver/mysql"
"log"
"net/http"
)
func main() {
//日志第一优先级保障
logger.LOGGER.Init()
defer logger.LOGGER.Destroy()
//装载配置文件,这个决定了是否需要执行安装过程
config.CONFIG.Init()
//全局运行的上下文
rest.CONTEXT.Init()
defer rest.CONTEXT.Destroy()
http.Handle("/", rest.CONTEXT.Router)
logger.LOGGER.Info("App started at http://localhost:%v", config.CONFIG.ServerPort)
dotPort := fmt.Sprintf(":%v", config.CONFIG.ServerPort)
err1 := http.ListenAndServe(dotPort, nil)
if err1 != nil {
log.Fatal("ListenAndServe: ", err1)
}
}