go-zero/tools/goctl/util/head.go
foliet 07128213d6
chore: update "DO NOT EDIT" format (#2559)
* chore: update "DO NOT EDIT" format

* Update readme.md

* Update head.go
2022-10-27 19:41:24 +08:00

18 lines
451 B
Go

package util
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 + `
// Source: {{.source}}`
)
// GetHead returns a code head string with source filename
func GetHead(source string) string {
buffer, _ := With("head").Parse(headTemplate).Execute(map[string]interface{}{
"source": source,
})
return buffer.String()
}