From 812b8c4e5b824d25b722fddb183b2f9d923685d9 Mon Sep 17 00:00:00 2001 From: hudangwei Date: Tue, 30 May 2017 19:43:40 +0800 Subject: [PATCH] if tag.Comment is empty, the ORM tag string will not contain description --- generate/g_appcode.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/generate/g_appcode.go b/generate/g_appcode.go index a514263..42c5445 100644 --- a/generate/g_appcode.go +++ b/generate/g_appcode.go @@ -256,7 +256,10 @@ func (tag *OrmTag) String() string { if len(ormOptions) == 0 { return "" } - return fmt.Sprintf("`orm:\"%s\" description:\"%s\"`", strings.Join(ormOptions, ";"), tag.Comment) + if tag.Comment != "" { + return fmt.Sprintf("`orm:\"%s\" description:\"%s\"`", strings.Join(ormOptions, ";"), tag.Comment) + } + return fmt.Sprintf("`orm:\"%s\"`", strings.Join(ormOptions, ";")) } func GenerateAppcode(driver, connStr, level, tables, currpath string) {