Fix/issue#1447 (#1458)
* Add data for template to render * fix #1447 Co-authored-by: anqiansong <anqiansong@bytedance.com>
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
|
||||
)
|
||||
|
||||
func genImports(withCache, timeImport bool) (string, error) {
|
||||
func genImports(withCache, timeImport bool, table Table) (string, error) {
|
||||
if withCache {
|
||||
text, err := pathx.LoadTemplate(category, importsTemplateFile, template.Imports)
|
||||
if err != nil {
|
||||
@@ -15,6 +15,7 @@ func genImports(withCache, timeImport bool) (string, error) {
|
||||
|
||||
buffer, err := util.With("import").Parse(text).Execute(map[string]interface{}{
|
||||
"time": timeImport,
|
||||
"data": table,
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -30,6 +31,7 @@ func genImports(withCache, timeImport bool) (string, error) {
|
||||
|
||||
buffer, err := util.With("import").Parse(text).Execute(map[string]interface{}{
|
||||
"time": timeImport,
|
||||
"data": table,
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
||||
Reference in New Issue
Block a user