Add do-not-edit banner to generated files

This commit is contained in:
2018-06-23 23:50:01 +02:00
parent b06910f223
commit 3403a1c118
23 changed files with 82 additions and 34 deletions
+5 -1
View File
@@ -99,6 +99,10 @@ func renderBytes(src []byte, typ genericType) []byte {
func render(src string, typ genericType) string {
const genericTypeName = "TypeName"
const doNotEditBanner = `/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
`
// Replace test constants
src = strings.Replace(src, "One TypeName = 1", "One TypeName = "+typ.testVals[0], 1)
src = strings.Replace(src, "Two TypeName = 2", "Two TypeName = "+typ.testVals[1], 1)
@@ -107,7 +111,7 @@ func render(src string, typ genericType) string {
src = strings.Replace(src, "Five TypeName = 5", "Five TypeName = "+typ.testVals[4], 1)
// Replace the type name
src = strings.Replace(src, genericTypeName, typ.name, -1)
return src
return doNotEditBanner + src
}
func gofmt(dir string) error {