From fafe362f4077989ce8618c77fa7d6ffb5f7093a9 Mon Sep 17 00:00:00 2001 From: xxjwxc Date: Fri, 1 May 2020 12:22:21 +0800 Subject: [PATCH] fix logout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 整理代码输出 --- config.yml | 6 +++--- data/cmd/cmd.go | 12 ++++++------ data/config/common.go | 2 +- data/view/gtools/gtools.go | 11 ++++++----- go.mod | 2 +- go.sum | 4 ++-- 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/config.yml b/config.yml index d429c33..96c6c36 100644 --- a/config.yml +++ b/config.yml @@ -13,9 +13,9 @@ is_foreign_key : true # 是否导出外键关联 is_gui : false # 是否ui模式显示 is_table_name : false # 是否直接生成表名函数 mysql_info: - host : 127.0.0.1 + host : 101.132.130.169 port : 3306 username : root - password : qwer - database : oauth_db + password : 123456 + database : ams diff --git a/data/cmd/cmd.go b/data/cmd/cmd.go index 3609dbb..9fba445 100644 --- a/data/cmd/cmd.go +++ b/data/cmd/cmd.go @@ -1,13 +1,13 @@ package cmd import ( - "fmt" "os" "strings" - "github.com/xxjwxc/public/tools" + "github.com/xxjwxc/public/mylog" "github.com/xxjwxc/gormt/data/view/gtools" + "github.com/xxjwxc/public/tools" "github.com/xxjwxc/gormt/data/config" @@ -85,12 +85,12 @@ func initConfig() { validate := validator.New() err := validate.Struct(config.GetMysqlDbInfo()) if err != nil { - fmt.Println("Can't read cmd: using (-h, --help) to get more imfo") - fmt.Println("error info: ", err, err) + mylog.Info("Can't read cmd: using (-h, --help) to get more imfo") + mylog.Error(err) os.Exit(1) } else { - fmt.Println("using config info:") - fmt.Println(tools.GetJSONStr(config.GetMysqlDbInfo(), true)) + mylog.Info("using database info:") + mylog.Info(tools.GetJSONStr(config.GetMysqlDbInfo(), true)) } } diff --git a/data/config/common.go b/data/config/common.go index af1fbd6..7d2e496 100644 --- a/data/config/common.go +++ b/data/config/common.go @@ -47,7 +47,7 @@ var _map = Config{ var configPath string func init() { - configPath = path.Join(tools.GetModelPath(), "config.yml") + configPath = path.Join(tools.GetCurrentDirectory(), "config.yml") onInit() dev.OnSetDev(_map.IsDev) } diff --git a/data/view/gtools/gtools.go b/data/view/gtools/gtools.go index f516c79..99e39c7 100644 --- a/data/view/gtools/gtools.go +++ b/data/view/gtools/gtools.go @@ -1,9 +1,10 @@ package gtools import ( - "fmt" "os/exec" + "github.com/xxjwxc/public/mylog" + "github.com/xxjwxc/gormt/data/dlg" "github.com/xxjwxc/gormt/data/view/model" @@ -39,12 +40,12 @@ func showCmd() { path := config.GetOutDir() + "/" + v.FileName tools.WriteFile(path, []string{v.FileCtx}, true) - fmt.Println("formatting differs from goimport's:") + mylog.Info("formatting differs from goimport's:") cmd, _ := exec.Command("goimports", "-l", "-w", path).Output() - fmt.Println(string(cmd)) + mylog.Info(string(cmd)) - fmt.Println("formatting differs from gofmt's:") + mylog.Info("formatting differs from gofmt's:") cmd, _ = exec.Command("gofmt", "-l", "-w", path).Output() - fmt.Println(string(cmd)) + mylog.Info(string(cmd)) } } diff --git a/go.mod b/go.mod index e7beafe..33d5e62 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/leodido/go-urn v1.2.0 // indirect github.com/nicksnyder/go-i18n/v2 v2.0.3 github.com/spf13/cobra v0.0.5 - github.com/xxjwxc/public v0.0.0-20200404170513-2f5f74aae818 + github.com/xxjwxc/public v0.0.0-20200501040822-aad701d0c120 golang.org/x/text v0.3.2 gopkg.in/go-playground/validator.v9 v9.30.2 gopkg.in/yaml.v2 v2.2.7 // indirect diff --git a/go.sum b/go.sum index 13d1483..69108ae 100644 --- a/go.sum +++ b/go.sum @@ -152,8 +152,8 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/xxjwxc/public v0.0.0-20200404170513-2f5f74aae818 h1:A1ImXFyLbNBEhuAkvBtpEAQVADN8mxuoZYA53VsNr2Y= -github.com/xxjwxc/public v0.0.0-20200404170513-2f5f74aae818/go.mod h1:8c3gMuRJkSGX3DpDvxU0fWfEEbuMi1LxPsKEBp97dnc= +github.com/xxjwxc/public v0.0.0-20200501040822-aad701d0c120 h1:VOQeHJdmUdPiKapx+0Uf+Et27Fg6mBSG7oUvvwBgruc= +github.com/xxjwxc/public v0.0.0-20200501040822-aad701d0c120/go.mod h1:8c3gMuRJkSGX3DpDvxU0fWfEEbuMi1LxPsKEBp97dnc= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=