From d78c3d434097e4a9bde8b82b1fcb9a30d6f70f0f Mon Sep 17 00:00:00 2001 From: liangzy Date: Mon, 31 Aug 2020 15:30:48 +0800 Subject: [PATCH] project init --- README.md | 8 +++++++- cmd/new.go | 6 +----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5d268d4..b338d9a 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,13 @@ A flexsible and powerful command line tool to initialize beego framework ## Installation - +1. 打开 go modules +``` +export GO111MODULE=on +# or +go env -w GO111MODULE=on +``` +2. 下载 ``` go get golib.gaore.com/GaoreGo/beegoinit-cmd ``` diff --git a/cmd/new.go b/cmd/new.go index 3c9d94c..7545d0b 100644 --- a/cmd/new.go +++ b/cmd/new.go @@ -87,15 +87,11 @@ var initfun = ` package applications import ( - "errors" "github.com/astaxie/beego" - "golib.gaore.com/GaoreGo/beegoinit/response" router "golib.gaore.com/GaoreGo/beegoinit/routers" - "golib.gaore.com/GaoreGo/grconfig" "golib.gaore.com/GaoreGo/grlogs" common "{{ packageName }}/applications/_common/controllers" api "{{ packageName }}/applications/api/controllers" - "strings" ) func init() { @@ -233,7 +229,7 @@ func New(c *cli.Context) error { os.MkdirAll(path.Join(appPath, "applications", "_common", "views"), 0755) os.MkdirAll(path.Join(appPath, "applications", "api", "controllers"), 0755) - utils.WriteToFile(path.Join(appPath, "main1.go"), strings.ReplaceAll(mainfun, "{{ packageName }}", packageName)) + utils.WriteToFile(path.Join(appPath, "main.go"), strings.ReplaceAll(mainfun, "{{ packageName }}", packageName)) utils.WriteToFile(path.Join(appPath, "applications", "init.go"), strings.ReplaceAll(initfun, "{{ packageName }}", packageName)) utils.WriteToFile(path.Join(appPath, "conf", "app.conf"), strings.ReplaceAll(appconf, "{{ packageName }}", packageName)) utils.WriteToFile(path.Join(appPath, "applications", "_common", "views", "404.tpl"), indextpl)