Add do-not-edit banner to generated files
This commit is contained in:
parent
b06910f223
commit
3403a1c118
|
@ -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 {
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
|
|||
s := New(One, Two, Three)
|
||||
out := s.Slice()
|
||||
exp := []int{One, Two, Three}
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b int) bool {
|
||||
return a < b
|
||||
})
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b int) bool { return a < b })
|
||||
if !cmp.Equal(exp, out, ignoreOrder) {
|
||||
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
|
|||
s := New(One, Two, Three)
|
||||
out := s.Slice()
|
||||
exp := []int16{One, Two, Three}
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b int16) bool {
|
||||
return a < b
|
||||
})
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b int16) bool { return a < b })
|
||||
if !cmp.Equal(exp, out, ignoreOrder) {
|
||||
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
|
|||
s := New(One, Two, Three)
|
||||
out := s.Slice()
|
||||
exp := []int32{One, Two, Three}
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b int32) bool {
|
||||
return a < b
|
||||
})
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b int32) bool { return a < b })
|
||||
if !cmp.Equal(exp, out, ignoreOrder) {
|
||||
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
|
|||
s := New(One, Two, Three)
|
||||
out := s.Slice()
|
||||
exp := []int64{One, Two, Three}
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b int64) bool {
|
||||
return a < b
|
||||
})
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b int64) bool { return a < b })
|
||||
if !cmp.Equal(exp, out, ignoreOrder) {
|
||||
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
|
|||
s := New(One, Two, Three)
|
||||
out := s.Slice()
|
||||
exp := []int8{One, Two, Three}
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b int8) bool {
|
||||
return a < b
|
||||
})
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b int8) bool { return a < b })
|
||||
if !cmp.Equal(exp, out, ignoreOrder) {
|
||||
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
|
|||
s := New(One, Two, Three)
|
||||
out := s.Slice()
|
||||
exp := []string{One, Two, Three}
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b string) bool {
|
||||
return a < b
|
||||
})
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b string) bool { return a < b })
|
||||
if !cmp.Equal(exp, out, ignoreOrder) {
|
||||
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
|
|||
s := New(One, Two, Three)
|
||||
out := s.Slice()
|
||||
exp := []uint{One, Two, Three}
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b uint) bool {
|
||||
return a < b
|
||||
})
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b uint) bool { return a < b })
|
||||
if !cmp.Equal(exp, out, ignoreOrder) {
|
||||
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
|
|||
s := New(One, Two, Three)
|
||||
out := s.Slice()
|
||||
exp := []uint16{One, Two, Three}
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b uint16) bool {
|
||||
return a < b
|
||||
})
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b uint16) bool { return a < b })
|
||||
if !cmp.Equal(exp, out, ignoreOrder) {
|
||||
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
|
|||
s := New(One, Two, Three)
|
||||
out := s.Slice()
|
||||
exp := []uint32{One, Two, Three}
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b uint32) bool {
|
||||
return a < b
|
||||
})
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b uint32) bool { return a < b })
|
||||
if !cmp.Equal(exp, out, ignoreOrder) {
|
||||
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
|
|||
s := New(One, Two, Three)
|
||||
out := s.Slice()
|
||||
exp := []uint64{One, Two, Three}
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b uint64) bool {
|
||||
return a < b
|
||||
})
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b uint64) bool { return a < b })
|
||||
if !cmp.Equal(exp, out, ignoreOrder) {
|
||||
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/*******************************************************************************
|
||||
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
|
||||
*******************************************************************************/
|
||||
package impl
|
||||
|
||||
import (
|
||||
|
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
|
|||
s := New(One, Two, Three)
|
||||
out := s.Slice()
|
||||
exp := []uint8{One, Two, Three}
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b uint8) bool {
|
||||
return a < b
|
||||
})
|
||||
ignoreOrder := cmpopts.SortSlices(func(a, b uint8) bool { return a < b })
|
||||
if !cmp.Equal(exp, out, ignoreOrder) {
|
||||
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue