1
0
Fork 0

Add do-not-edit banner to generated files

This commit is contained in:
Gregory Eremin 2018-06-23 23:50:01 +02:00
parent b06910f223
commit 3403a1c118
No known key found for this signature in database
GPG Key ID: 8CB79D42167BEB7F
23 changed files with 82 additions and 34 deletions

View File

@ -99,6 +99,10 @@ func renderBytes(src []byte, typ genericType) []byte {
func render(src string, typ genericType) string { func render(src string, typ genericType) string {
const genericTypeName = "TypeName" const genericTypeName = "TypeName"
const doNotEditBanner = `/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
`
// Replace test constants // Replace test constants
src = strings.Replace(src, "One TypeName = 1", "One TypeName = "+typ.testVals[0], 1) 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) 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) src = strings.Replace(src, "Five TypeName = 5", "Five TypeName = "+typ.testVals[4], 1)
// Replace the type name // Replace the type name
src = strings.Replace(src, genericTypeName, typ.name, -1) src = strings.Replace(src, genericTypeName, typ.name, -1)
return src return doNotEditBanner + src
} }
func gofmt(dir string) error { func gofmt(dir string) error {

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
s := New(One, Two, Three) s := New(One, Two, Three)
out := s.Slice() out := s.Slice()
exp := []int{One, Two, Three} exp := []int{One, Two, Three}
ignoreOrder := cmpopts.SortSlices(func(a, b int) bool { ignoreOrder := cmpopts.SortSlices(func(a, b int) bool { return a < b })
return a < b
})
if !cmp.Equal(exp, out, ignoreOrder) { if !cmp.Equal(exp, out, ignoreOrder) {
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out)) t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
} }

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
s := New(One, Two, Three) s := New(One, Two, Three)
out := s.Slice() out := s.Slice()
exp := []int16{One, Two, Three} exp := []int16{One, Two, Three}
ignoreOrder := cmpopts.SortSlices(func(a, b int16) bool { ignoreOrder := cmpopts.SortSlices(func(a, b int16) bool { return a < b })
return a < b
})
if !cmp.Equal(exp, out, ignoreOrder) { if !cmp.Equal(exp, out, ignoreOrder) {
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out)) t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
} }

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
s := New(One, Two, Three) s := New(One, Two, Three)
out := s.Slice() out := s.Slice()
exp := []int32{One, Two, Three} exp := []int32{One, Two, Three}
ignoreOrder := cmpopts.SortSlices(func(a, b int32) bool { ignoreOrder := cmpopts.SortSlices(func(a, b int32) bool { return a < b })
return a < b
})
if !cmp.Equal(exp, out, ignoreOrder) { if !cmp.Equal(exp, out, ignoreOrder) {
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out)) t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
} }

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
s := New(One, Two, Three) s := New(One, Two, Three)
out := s.Slice() out := s.Slice()
exp := []int64{One, Two, Three} exp := []int64{One, Two, Three}
ignoreOrder := cmpopts.SortSlices(func(a, b int64) bool { ignoreOrder := cmpopts.SortSlices(func(a, b int64) bool { return a < b })
return a < b
})
if !cmp.Equal(exp, out, ignoreOrder) { if !cmp.Equal(exp, out, ignoreOrder) {
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out)) t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
} }

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
s := New(One, Two, Three) s := New(One, Two, Three)
out := s.Slice() out := s.Slice()
exp := []int8{One, Two, Three} exp := []int8{One, Two, Three}
ignoreOrder := cmpopts.SortSlices(func(a, b int8) bool { ignoreOrder := cmpopts.SortSlices(func(a, b int8) bool { return a < b })
return a < b
})
if !cmp.Equal(exp, out, ignoreOrder) { if !cmp.Equal(exp, out, ignoreOrder) {
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out)) t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
} }

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
s := New(One, Two, Three) s := New(One, Two, Three)
out := s.Slice() out := s.Slice()
exp := []string{One, Two, Three} exp := []string{One, Two, Three}
ignoreOrder := cmpopts.SortSlices(func(a, b string) bool { ignoreOrder := cmpopts.SortSlices(func(a, b string) bool { return a < b })
return a < b
})
if !cmp.Equal(exp, out, ignoreOrder) { if !cmp.Equal(exp, out, ignoreOrder) {
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out)) t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
} }

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
s := New(One, Two, Three) s := New(One, Two, Three)
out := s.Slice() out := s.Slice()
exp := []uint{One, Two, Three} exp := []uint{One, Two, Three}
ignoreOrder := cmpopts.SortSlices(func(a, b uint) bool { ignoreOrder := cmpopts.SortSlices(func(a, b uint) bool { return a < b })
return a < b
})
if !cmp.Equal(exp, out, ignoreOrder) { if !cmp.Equal(exp, out, ignoreOrder) {
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out)) t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
} }

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
s := New(One, Two, Three) s := New(One, Two, Three)
out := s.Slice() out := s.Slice()
exp := []uint16{One, Two, Three} exp := []uint16{One, Two, Three}
ignoreOrder := cmpopts.SortSlices(func(a, b uint16) bool { ignoreOrder := cmpopts.SortSlices(func(a, b uint16) bool { return a < b })
return a < b
})
if !cmp.Equal(exp, out, ignoreOrder) { if !cmp.Equal(exp, out, ignoreOrder) {
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out)) t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
} }

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
s := New(One, Two, Three) s := New(One, Two, Three)
out := s.Slice() out := s.Slice()
exp := []uint32{One, Two, Three} exp := []uint32{One, Two, Three}
ignoreOrder := cmpopts.SortSlices(func(a, b uint32) bool { ignoreOrder := cmpopts.SortSlices(func(a, b uint32) bool { return a < b })
return a < b
})
if !cmp.Equal(exp, out, ignoreOrder) { if !cmp.Equal(exp, out, ignoreOrder) {
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out)) t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
} }

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
s := New(One, Two, Three) s := New(One, Two, Three)
out := s.Slice() out := s.Slice()
exp := []uint64{One, Two, Three} exp := []uint64{One, Two, Three}
ignoreOrder := cmpopts.SortSlices(func(a, b uint64) bool { ignoreOrder := cmpopts.SortSlices(func(a, b uint64) bool { return a < b })
return a < b
})
if !cmp.Equal(exp, out, ignoreOrder) { if !cmp.Equal(exp, out, ignoreOrder) {
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out)) t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
} }

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (

View File

@ -1,3 +1,6 @@
/*******************************************************************************
THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT!
*******************************************************************************/
package impl package impl
import ( import (
@ -98,9 +101,7 @@ func TestSlice(t *testing.T) {
s := New(One, Two, Three) s := New(One, Two, Three)
out := s.Slice() out := s.Slice()
exp := []uint8{One, Two, Three} exp := []uint8{One, Two, Three}
ignoreOrder := cmpopts.SortSlices(func(a, b uint8) bool { ignoreOrder := cmpopts.SortSlices(func(a, b uint8) bool { return a < b })
return a < b
})
if !cmp.Equal(exp, out, ignoreOrder) { if !cmp.Equal(exp, out, ignoreOrder) {
t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out)) t.Errorf("Retured slice does not match: %s", cmp.Diff(exp, out))
} }