fix bug: miss time import (#36)
* add execute files * add protoc-osx * add rpc generation * add rpc generation * add: rpc template generation * optimize gomod cache * add README.md * format error * reactor templatex.go * update project.go & README.md * fix bug: miss time import
This commit is contained in:
@@ -2,12 +2,25 @@ package gen
|
||||
|
||||
import (
|
||||
"github.com/tal-tech/go-zero/tools/goctl/model/sql/template"
|
||||
"github.com/tal-tech/go-zero/tools/goctl/util"
|
||||
)
|
||||
|
||||
func genImports(withCache bool) string {
|
||||
func genImports(withCache, timeImport bool) (string, error) {
|
||||
if withCache {
|
||||
return template.Imports
|
||||
buffer, err := util.With("import").Parse(template.Imports).Execute(map[string]interface{}{
|
||||
"time": timeImport,
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return buffer.String(), nil
|
||||
} else {
|
||||
return template.ImportsNoCache
|
||||
buffer, err := util.With("import").Parse(template.ImportsNoCache).Execute(map[string]interface{}{
|
||||
"time": timeImport,
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return buffer.String(), nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user