2020-10-19 23:13:18 +08:00
|
|
|
package util
|
2020-08-28 19:24:58 +08:00
|
|
|
|
2022-04-01 15:23:45 +08:00
|
|
|
const (
|
|
|
|
// DoNotEditHead added to the beginning of a file to prompt the user not to edit
|
|
|
|
DoNotEditHead = "// Code generated by goctl. DO NOT EDIT!"
|
2022-04-01 14:48:45 +08:00
|
|
|
|
2022-04-01 15:23:45 +08:00
|
|
|
headTemplate = DoNotEditHead + `
|
2020-08-28 19:24:58 +08:00
|
|
|
// Source: {{.source}}`
|
2022-04-01 15:23:45 +08:00
|
|
|
)
|
2020-08-28 19:24:58 +08:00
|
|
|
|
2021-02-26 16:11:47 +08:00
|
|
|
// GetHead returns a code head string with source filename
|
2020-08-28 19:24:58 +08:00
|
|
|
func GetHead(source string) string {
|
|
|
|
buffer, _ := With("head").Parse(headTemplate).Execute(map[string]interface{}{
|
|
|
|
"source": source,
|
|
|
|
})
|
|
|
|
return buffer.String()
|
|
|
|
}
|