head.go 443 B

1234567891011121314151617
  1. package util
  2. const (
  3. // DoNotEditHead added to the beginning of a file to prompt the user not to edit
  4. DoNotEditHead = "// Code generated by goctl. DO NOT EDIT."
  5. headTemplate = DoNotEditHead + `
  6. // Source: {{.source}}`
  7. )
  8. // GetHead returns a code head string with source filename
  9. func GetHead(source string) string {
  10. buffer, _ := With("head").Parse(headTemplate).Execute(map[string]any{
  11. "source": source,
  12. })
  13. return buffer.String()
  14. }