From d7b23aa54f26b6625989a60a2f16e72b02ba89a8 Mon Sep 17 00:00:00 2001 From: itcbx Date: Sat, 29 Aug 2015 15:14:21 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E6=97=B6=EF=BC=8C@Sucess=20=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E4=B8=AA=E5=8F=82=E6=95=B0=E8=A7=A3=E6=9E=90=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原来的代码,当第三个参数有多个空格时,比如 // @Success 200 {string} delete success! 第三个参数会解析成success!,即会忽略第一个空格前的单词,修改后,可以正常解析。 --- g_docs.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/g_docs.go b/g_docs.go index ea2ef00..3db26a8 100644 --- a/g_docs.go +++ b/g_docs.go @@ -395,10 +395,13 @@ func parserComments(comments *ast.CommentGroup, funcName, controllerName, pkgpat tmp = make([]rune, 0) j += 1 start = false - continue - } else { - st[j] = strings.TrimSpace(ss[i+1:]) - break + if j == 1 { + continue + } else { + st[j] = strings.TrimSpace(ss[i+1:]) + break + + } } } else { start = true From 19b8add1c518b670e0a35f3130097433edd05039 Mon Sep 17 00:00:00 2001 From: Mark Mindenhall Date: Wed, 10 Feb 2016 12:39:02 -0700 Subject: [PATCH 2/6] Support go build tags (issue #149) --- run.go | 6 +++++- watch.go | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/run.go b/run.go index ec136b6..3d4da70 100644 --- a/run.go +++ b/run.go @@ -26,7 +26,7 @@ import ( ) var cmdRun = &Command{ - UsageLine: "run [appname] [watchall] [-main=*.go] [-downdoc=true] [-gendoc=true] [-e=Godeps -e=folderToExclude]", + UsageLine: "run [appname] [watchall] [-main=*.go] [-downdoc=true] [-gendoc=true] [-e=Godeps -e=folderToExclude] [-tags=goBuildTags]", Short: "run the app and start a Web server for development", Long: ` Run command will supervise the file system of the beego project using inotify, @@ -43,12 +43,16 @@ var gendoc docValue // The flags list of the paths excluded from watching var excludedPaths strFlags +// Pass through to -tags arg of "go build" +var buildTags string + func init() { cmdRun.Run = runApp cmdRun.Flag.Var(&mainFiles, "main", "specify main go files") cmdRun.Flag.Var(&gendoc, "gendoc", "auto generate the docs") cmdRun.Flag.Var(&downdoc, "downdoc", "auto download swagger file when not exist") cmdRun.Flag.Var(&excludedPaths, "e", "Excluded paths[].") + cmdRun.Flag.StringVar(&buildTags, "tags", "", "Build tags (https://golang.org/pkg/go/build/)") } var appname string diff --git a/watch.go b/watch.go index f18dd3c..371598e 100644 --- a/watch.go +++ b/watch.go @@ -170,6 +170,9 @@ func Autobuild(files []string, isgenerate bool) { args := []string{"build"} args = append(args, "-o", appName) + if buildTags != "" { + args = append(args, "-tags", buildTags) + } args = append(args, files...) bcmd := exec.Command(cmdName, args...) From 6481a96ca4506c769f1c6b1794d32f6c91237aa0 Mon Sep 17 00:00:00 2001 From: Liut Date: Fri, 11 Mar 2016 23:39:17 +0800 Subject: [PATCH 3/6] =?UTF-8?q?allow=20any=20schema=20in=20PostgresDB;=20?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E9=80=89=E6=8B=A9=20PostgreSQL=EF=BC=8C?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E5=AE=9A=E5=88=B6=E7=9A=84=20schema;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- g_appcode.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/g_appcode.go b/g_appcode.go index f5f6b0d..7860912 100644 --- a/g_appcode.go +++ b/g_appcode.go @@ -516,7 +516,9 @@ func (*MysqlDB) GetGoDataType(sqlType string) (goType string) { func (*PostgresDB) GetTableNames(db *sql.DB) (tables []string) { rows, err := db.Query(` SELECT table_name FROM information_schema.tables - WHERE table_catalog = current_database() and table_schema = 'public'`) + WHERE table_catalog = current_database() AND + table_type = 'BASE TABLE' AND + table_schema NOT IN ('pg_catalog', 'information_schema')`) if err != nil { ColorLog("[ERRO] Could not show tables: %s\n", err) ColorLog("[HINT] Check your connection string\n") @@ -551,8 +553,10 @@ func (*PostgresDB) GetConstraints(db *sql.DB, table *Table, blackList map[string INNER JOIN information_schema.constraint_column_usage cu ON cu.constraint_name = c.constraint_name WHERE - c.table_catalog = current_database() AND c.table_schema = 'public' AND c.table_name = $1 - AND u.table_catalog = current_database() AND u.table_schema = 'public' AND u.table_name = $2`, + c.table_catalog = current_database() AND c.table_schema NOT IN ('pg_catalog', 'information_schema') + AND c.table_name = $1 + AND u.table_catalog = current_database() AND u.table_schema NOT IN ('pg_catalog', 'information_schema') + AND u.table_name = $2`, table.Name, table.Name) // u.position_in_unique_constraint, if err != nil { ColorLog("[ERRO] Could not query INFORMATION_SCHEMA for PK/UK/FK information: %s\n", err) @@ -608,7 +612,8 @@ func (postgresDB *PostgresDB) GetColumns(db *sql.DB, table *Table, blackList map FROM information_schema.columns WHERE - table_catalog = current_database() AND table_schema = 'public' AND table_name = $1`, + table_catalog = current_database() AND table_schema NOT IN ('pg_catalog', 'information_schema') + AND table_name = $1`, table.Name) defer colDefRows.Close() for colDefRows.Next() { @@ -985,12 +990,12 @@ func getPackagePath(curpath string) (packpath string) { ColorLog("[ERRO] Can't generate application code outside of GOPATH '%s'\n", gopath) os.Exit(2) } - + if curpath == appsrcpath { ColorLog("[ERRO] Can't generate application code outside of application PATH \n") os.Exit(2) } - + packpath = strings.Join(strings.Split(curpath[len(appsrcpath)+1:], string(filepath.Separator)), "/") return } From 7210ac621d012af8282f6685cfb5baed48bd80da Mon Sep 17 00:00:00 2001 From: Sergey Lanzman Date: Sat, 12 Mar 2016 14:05:15 +0200 Subject: [PATCH 4/6] optimisation disable GC for go build , go list, go install +20% speed on large projects --- watch.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/watch.go b/watch.go index 371598e..7d966bd 100644 --- a/watch.go +++ b/watch.go @@ -136,6 +136,7 @@ func Autobuild(files []string, isgenerate bool) { icmd := exec.Command("go", "list", "./...") buf := bytes.NewBuffer([]byte("")) icmd.Stdout = buf + icmd.Env = append(os.Environ(), "GOGC=off") err = icmd.Run() if err == nil { list := strings.Split(buf.String(), "\n")[1:] @@ -146,6 +147,7 @@ func Autobuild(files []string, isgenerate bool) { icmd = exec.Command(cmdName, "install", pkg) icmd.Stdout = os.Stdout icmd.Stderr = os.Stderr + icmd.Env = append(os.Environ(), "GOGC=off") err = icmd.Run() if err != nil { break @@ -156,6 +158,7 @@ func Autobuild(files []string, isgenerate bool) { if isgenerate { icmd := exec.Command("bee", "generate", "docs") + icmd.Env = append(os.Environ(), "GOGC=off") icmd.Stdout = os.Stdout icmd.Stderr = os.Stderr icmd.Run() @@ -176,6 +179,7 @@ func Autobuild(files []string, isgenerate bool) { args = append(args, files...) bcmd := exec.Command(cmdName, args...) + bcmd.Env = append(os.Environ(), "GOGC=off") bcmd.Stdout = os.Stdout bcmd.Stderr = os.Stderr err = bcmd.Run() From e523bf5da4e717c6670522a86fcf1dbb7b821c4b Mon Sep 17 00:00:00 2001 From: Dmitri Logvinenko Date: Sun, 27 Mar 2016 16:42:26 +0300 Subject: [PATCH 5/6] Fix misspelling and improve command description --- fix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fix.go b/fix.go index 69d6584..3e1d3d6 100644 --- a/fix.go +++ b/fix.go @@ -12,7 +12,7 @@ import ( var cmdFix = &Command{ UsageLine: "fix", - Short: "fix the beego application to compatibel with beego 1.6", + Short: "fix the beego application to make it compatible with beego 1.6", Long: ` As from beego1.6, there's some incompatible code with the old version. From d312a60e4f4c8456c411d3cbb47914136dbd6158 Mon Sep 17 00:00:00 2001 From: Dmitry Burakov Date: Sat, 2 Apr 2016 21:37:58 +0300 Subject: [PATCH 6/6] changed required go version [issue 172] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b597b54..5bad9ee 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Bee is a command line tool facilitating development with beego framework. ## Requirements -- Go version >= 1.1. +- Go version >= 1.3. ## Installation