diff --git a/Makefile b/Makefile index f550599..666e8f1 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,18 @@ -all: - make windows - make mac - make linux +all: # 构建 + make tar make clear windows: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o gormt.exe main.go - tar czvf gormt_windows.zip gormt.exe config.yml mac: CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o gormt main.go - tar czvf gormt_mac.zip gormt config.yml linux: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o gormt main.go +tar: # 打包 + CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o gormt.exe main.go + tar czvf gormt_windows.zip gormt.exe config.yml + CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o gormt main.go + tar czvf gormt_mac.zip gormt config.yml + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o gormt main.go tar czvf gormt_linux.zip gormt config.yml clear: - rm -rf model/* diff --git a/data/config/common.go b/data/config/common.go index 47a3702..3c21f4a 100644 --- a/data/config/common.go +++ b/data/config/common.go @@ -2,11 +2,13 @@ package config import ( "fmt" + "io/ioutil" + "os" + "path" + "github.com/xxjwxc/public/dev" "github.com/xxjwxc/public/tools" "gopkg.in/yaml.v3" - "io/ioutil" - "os" ) // CfgBase base config struct @@ -42,10 +44,10 @@ var _map = Config{ IsGUI: false, } -var configPath string = "gormt.yml" +var configPath string func init() { - // configPath = path.Join(tools.GetModelPath(), "config.yml") + configPath = path.Join(tools.GetModelPath(), "config.yml") onInit() dev.OnSetDev(_map.IsDev) } @@ -61,11 +63,11 @@ func onInit() { // InitFile default value from file . func InitFile(filename string) error { if _, e := os.Stat(filename); e != nil { - fmt.Println("配置文件未初始化,正在自动初始化配置文件", filename) + fmt.Println("init default config file", filename) if err := SaveToFile(); err == nil { - fmt.Println("配置文件初始化完毕") + fmt.Println("done,please restart.") } else { - fmt.Println("配置文件初始化异常", err) + fmt.Println("shit,fail", err) } os.Exit(0) } diff --git a/go.mod b/go.mod index 3cdc42c..d606472 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/xxjwxc/gormt go 1.13 require ( - github.com/fzipp/gocyclo v0.0.0-20150627053110-6acd4345c835 // indirect github.com/go-playground/universal-translator v0.17.0 // indirect github.com/go-sql-driver/mysql v1.4.1 github.com/jinzhu/gorm v1.9.11 diff --git a/go.sum b/go.sum index 78aeb5e..89a5129 100644 --- a/go.sum +++ b/go.sum @@ -36,8 +36,6 @@ github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DP github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0= github.com/ezbuy/tgen v0.0.0-20180109020500-95ef13895032/go.mod h1:OeW1N0acAlRaGTlOG8jRZZUKEtyiGa0qvD+lWNWb9vs= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fzipp/gocyclo v0.0.0-20150627053110-6acd4345c835 h1:roDmqJ4Qes7hrDOsWsMCce0vQHz3xiMPjJ9m4c2eeNs= -github.com/fzipp/gocyclo v0.0.0-20150627053110-6acd4345c835/go.mod h1:BjL/N0+C+j9uNX+1xcNuM9vdSIcXCZrQZUYbXOFbgN8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= @@ -103,7 +101,6 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nicksnyder/go-i18n v2.0.3+incompatible h1:XCCaWsCoy4KlWkhOr+63dkv6oJmitJ573uJqDBAiFiQ= github.com/nicksnyder/go-i18n/v2 v2.0.3 h1:ks/JkQiOEhhuF6jpNvx+Wih1NIiXzUnZeZVnJuI8R8M= github.com/nicksnyder/go-i18n/v2 v2.0.3/go.mod h1:oDab7q8XCYMRlcrBnaY/7B1eOectbvj6B1UPBT+p5jo= github.com/nsf/termbox-go v0.0.0-20191229070316-58d4fcbce2a7 h1:OkWEy7aQeQTbgdrcGi9bifx+Y6bMM7ae7y42hDFaBvA= @@ -146,11 +143,6 @@ 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-20191107073037-ea6b812d567f h1:PyaqoUhjkgpBGR/8LXWvk3yzrILMXC7Ygu8xhl5+sM8= -github.com/xxjwxc/public v0.0.0-20191107073037-ea6b812d567f/go.mod h1:j0CCXMUDtykGMfOoBpy1pfmzEeBk2JVusosjbgjfMZg= -github.com/xxjwxc/public v0.0.0-20200120133922-c61314a90a4a h1:sQ+O2UwDj1ShdZ6NLgp98cmaZLWrkFpVJB+wOzj1kDQ= -github.com/xxjwxc/public v0.0.0-20200120133922-c61314a90a4a/go.mod h1:UYQUNNJmUzNKpjY5ctz1n/XoJonmhAIgD51zS2rEsek= -github.com/xxjwxc/public v0.0.0-20200120153226-f36cf754df21 h1:1OF0Q6FGQhmziN4yvHLiF9XXOqfChL5z4rcogSQqCos= github.com/xxjwxc/public v0.0.0-20200221114751-56810b3fcc29 h1:C0fnjiwnCBjovovCTkrjVXQtqd+UdVD2N8yaVK8LHwk= github.com/xxjwxc/public v0.0.0-20200221114751-56810b3fcc29/go.mod h1:lhh94GsxhTweM/OaF7eFzOAgVV6fSSbBvA6zOtOVmdU= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -159,6 +151,7 @@ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c h1:Vj5n4GlwjmQteupaxJ9+0FNOmBrHfq7vN4btdGoDZgI= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284 h1:rlLehGeYg6jfoyz/eDqDU1iRXLKfR42nnNh57ytKEWo= golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=