mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-11 00:40:00 +08:00
Add goctl version to code header (#4293)
This commit is contained in:
@@ -1,17 +1,21 @@
|
||||
package util
|
||||
|
||||
import "github.com/zeromicro/go-zero/tools/goctl/internal/version"
|
||||
|
||||
const (
|
||||
// DoNotEditHead added to the beginning of a file to prompt the user not to edit
|
||||
DoNotEditHead = "// Code generated by goctl. DO NOT EDIT."
|
||||
|
||||
headTemplate = DoNotEditHead + `
|
||||
// goctl {{.version}}
|
||||
// Source: {{.source}}`
|
||||
)
|
||||
|
||||
// GetHead returns a code head string with source filename
|
||||
func GetHead(source string) string {
|
||||
buffer, _ := With("head").Parse(headTemplate).Execute(map[string]any{
|
||||
"source": source,
|
||||
"source": source,
|
||||
"version": version.BuildVersion,
|
||||
})
|
||||
return buffer.String()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user