feat: use go:embed to embed templates (#1756)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package tsgen
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"path"
|
||||
"strings"
|
||||
"text/template"
|
||||
@@ -10,12 +11,8 @@ import (
|
||||
"github.com/zeromicro/go-zero/tools/goctl/util/pathx"
|
||||
)
|
||||
|
||||
const (
|
||||
componentsTemplate = `// Code generated by goctl. DO NOT EDIT.
|
||||
|
||||
{{.componentTypes}}
|
||||
`
|
||||
)
|
||||
//go:embed components.tpl
|
||||
var componentsTemplate string
|
||||
|
||||
func genComponents(dir string, api *spec.ApiSpec) error {
|
||||
types := api.Types
|
||||
|
||||
Reference in New Issue
Block a user