change init

This commit is contained in:
zhangchao
2024-12-16 18:15:15 +08:00
parent 2947fa7d3e
commit f9b57db475
3 changed files with 4 additions and 18 deletions

16
main.go
View File

@@ -1,7 +1,6 @@
package main
import (
"flag"
"fmt"
"go_blog/conf"
"go_blog/controllers"
@@ -22,24 +21,11 @@ type User struct {
PasswordHash []byte
}
var host string
var port string
var isDebugMode bool
var isErrMsg bool
var isOrmDebug bool
const templatePath = "./templates/*"
func init() {
flag.StringVar(&host, "h", "127.0.0.1", "主机")
flag.StringVar(&port, "p", "", "监听端口")
flag.BoolVar(&isDebugMode, "debug", true, "是否开启debug")
flag.BoolVar(&isErrMsg, "err", true, "是否返回错误信息")
flag.BoolVar(&isOrmDebug, "orm", true, "是否开启gorm的debug信息")
flag.Parse()
conf.SetUp()
models.SetUp(isOrmDebug)
models.SetUp()
}
func main() {