mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-07 06:59:59 +08:00
Add goctl version to code header (#4293)
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/zeromicro/go-zero/tools/goctl/config"
|
||||
"github.com/zeromicro/go-zero/tools/goctl/internal/version"
|
||||
"github.com/zeromicro/go-zero/tools/goctl/model/mongo/template"
|
||||
"github.com/zeromicro/go-zero/tools/goctl/util"
|
||||
"github.com/zeromicro/go-zero/tools/goctl/util/format"
|
||||
@@ -59,6 +60,7 @@ func generateModel(ctx *Context) error {
|
||||
"Type": stringx.From(t).Title(),
|
||||
"lowerType": stringx.From(t).Untitle(),
|
||||
"Cache": ctx.Cache,
|
||||
"version": version.BuildVersion,
|
||||
}, output, true); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl {{.version}}
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
|
||||
"github.com/zeromicro/go-zero/tools/goctl/internal/version"
|
||||
"github.com/zeromicro/go-zero/tools/goctl/util"
|
||||
)
|
||||
|
||||
@@ -44,6 +45,8 @@ var ModelCustom string
|
||||
|
||||
// ModelGen defines a template for model
|
||||
var ModelGen = fmt.Sprintf(`%s
|
||||
// versions:
|
||||
// goctl version: %s
|
||||
|
||||
package {{.pkg}}
|
||||
{{.imports}}
|
||||
@@ -57,7 +60,7 @@ package {{.pkg}}
|
||||
{{.extraMethod}}
|
||||
{{.tableName}}
|
||||
{{.customized}}
|
||||
`, util.DoNotEditHead)
|
||||
`, util.DoNotEditHead, version.BuildVersion)
|
||||
|
||||
// Insert defines a template for insert code in model
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user