diff --git a/cmd/avrogen/testdata/golden.go b/cmd/avrogen/testdata/golden.go index e76aef6..ac853d8 100644 --- a/cmd/avrogen/testdata/golden.go +++ b/cmd/avrogen/testdata/golden.go @@ -1,7 +1,7 @@ // package testpkg is generated from schema.avsc package testpkg -// Code generated by avro/gen. DO NOT EDIT MANUALLY. +// Code generated by avro/gen. DO NOT EDIT. // Test is a test struct type Test struct { diff --git a/cmd/avrogen/testdata/golden_encoders.go b/cmd/avrogen/testdata/golden_encoders.go index 1c5b2fd..3223d40 100644 --- a/cmd/avrogen/testdata/golden_encoders.go +++ b/cmd/avrogen/testdata/golden_encoders.go @@ -1,6 +1,6 @@ package testpkg -// Code generated by avro/gen. DO NOT EDIT MANUALLY. +// Code generated by avro/gen. DO NOT EDIT. import ( "github.com/hamba/avro/v2" diff --git a/cmd/avrogen/testdata/golden_fullname.go b/cmd/avrogen/testdata/golden_fullname.go index bdec65c..fde53af 100644 --- a/cmd/avrogen/testdata/golden_fullname.go +++ b/cmd/avrogen/testdata/golden_fullname.go @@ -1,6 +1,6 @@ package testpkg -// Code generated by avro/gen. DO NOT EDIT MANUALLY. +// Code generated by avro/gen. DO NOT EDIT. // Test is a test struct type ABTest struct { diff --git a/cmd/avrogen/testdata/golden_stricttypes.go b/cmd/avrogen/testdata/golden_stricttypes.go index 1e721b3..0ddc2c8 100644 --- a/cmd/avrogen/testdata/golden_stricttypes.go +++ b/cmd/avrogen/testdata/golden_stricttypes.go @@ -1,6 +1,6 @@ package testpkg -// Code generated by avro/gen. DO NOT EDIT MANUALLY. +// Code generated by avro/gen. DO NOT EDIT. // Test is a test struct type Test struct { diff --git a/gen/gen.go b/gen/gen.go index 9a78552..38a798c 100644 --- a/gen/gen.go +++ b/gen/gen.go @@ -147,7 +147,7 @@ func WithStrictTypes(b bool) OptsFunc { } } -// WithPackageDoc configures the generator to use output the given text as a package doc comment. +// WithPackageDoc configures the generator to output the given text as a package doc comment. func WithPackageDoc(text string) OptsFunc { return func(g *Generator) { g.pkgdoc = text diff --git a/gen/output_template.tmpl b/gen/output_template.tmpl index 17a5411..1143fe5 100644 --- a/gen/output_template.tmpl +++ b/gen/output_template.tmpl @@ -3,7 +3,7 @@ {{- end }} package {{ .PackageName }} -// Code generated by avro/gen. DO NOT EDIT MANUALLY. +// Code generated by avro/gen. DO NOT EDIT. {{- $encoders := .WithEncoders }} {{ if len .Imports }} @@ -17,7 +17,9 @@ package {{ .PackageName }} {{- range .Typedefs }} {{- if len .Doc }} // {{ .Doc }} - {{- end}} + {{- else }} + // {{ .Name }} is a generated struct. + {{- end }} type {{ .Name }} struct { {{- range .Fields }} {{- $f := . }} diff --git a/gen/testdata/golden.go b/gen/testdata/golden.go index 724b5d3..8eb5918 100644 --- a/gen/testdata/golden.go +++ b/gen/testdata/golden.go @@ -1,6 +1,6 @@ package something -// Code generated by avro/gen. DO NOT EDIT MANUALLY. +// Code generated by avro/gen. DO NOT EDIT. import ( "math/big" @@ -9,35 +9,43 @@ import ( "github.com/hamba/avro/v2" ) +// InnerRecord is a generated struct. type InnerRecord struct { InnerJustBytes []byte `avro:"innerJustBytes"` InnerPrimitiveNullableArrayUnion *[]string `avro:"innerPrimitiveNullableArrayUnion"` } +// RecordInMap is a generated struct. type RecordInMap struct { Name string `avro:"name"` } +// RecordInArray is a generated struct. type RecordInArray struct { AString string `avro:"aString"` } +// RecordInNullableUnion is a generated struct. type RecordInNullableUnion struct { AString string `avro:"aString"` } +// Record1InNonNullableUnion is a generated struct. type Record1InNonNullableUnion struct { AString string `avro:"aString"` } +// Record2InNonNullableUnion is a generated struct. type Record2InNonNullableUnion struct { AString string `avro:"aString"` } +// Record1InNullableUnion is a generated struct. type Record1InNullableUnion struct { AString string `avro:"aString"` } +// Record2InNullableUnion is a generated struct. type Record2InNullableUnion struct { AString string `avro:"aString"` } diff --git a/gen/testdata/golden_encoders.go b/gen/testdata/golden_encoders.go index 5c8a830..190a293 100644 --- a/gen/testdata/golden_encoders.go +++ b/gen/testdata/golden_encoders.go @@ -1,6 +1,6 @@ package something -// Code generated by avro/gen. DO NOT EDIT MANUALLY. +// Code generated by avro/gen. DO NOT EDIT. import ( "math/big" @@ -9,6 +9,7 @@ import ( "github.com/hamba/avro/v2" ) +// InnerRecord is a generated struct. type InnerRecord struct { InnerJustBytes []byte `avro:"innerJustBytes"` InnerPrimitiveNullableArrayUnion *[]string `avro:"innerPrimitiveNullableArrayUnion"` @@ -31,6 +32,7 @@ func (o *InnerRecord) Marshal() ([]byte, error) { return avro.Marshal(o.Schema(), o) } +// RecordInMap is a generated struct. type RecordInMap struct { Name string `avro:"name"` } @@ -52,6 +54,7 @@ func (o *RecordInMap) Marshal() ([]byte, error) { return avro.Marshal(o.Schema(), o) } +// RecordInArray is a generated struct. type RecordInArray struct { AString string `avro:"aString"` } @@ -73,6 +76,7 @@ func (o *RecordInArray) Marshal() ([]byte, error) { return avro.Marshal(o.Schema(), o) } +// RecordInNullableUnion is a generated struct. type RecordInNullableUnion struct { AString string `avro:"aString"` } @@ -94,6 +98,7 @@ func (o *RecordInNullableUnion) Marshal() ([]byte, error) { return avro.Marshal(o.Schema(), o) } +// Record1InNonNullableUnion is a generated struct. type Record1InNonNullableUnion struct { AString string `avro:"aString"` } @@ -115,6 +120,7 @@ func (o *Record1InNonNullableUnion) Marshal() ([]byte, error) { return avro.Marshal(o.Schema(), o) } +// Record2InNonNullableUnion is a generated struct. type Record2InNonNullableUnion struct { AString string `avro:"aString"` } @@ -136,6 +142,7 @@ func (o *Record2InNonNullableUnion) Marshal() ([]byte, error) { return avro.Marshal(o.Schema(), o) } +// Record1InNullableUnion is a generated struct. type Record1InNullableUnion struct { AString string `avro:"aString"` } @@ -157,6 +164,7 @@ func (o *Record1InNullableUnion) Marshal() ([]byte, error) { return avro.Marshal(o.Schema(), o) } +// Record2InNullableUnion is a generated struct. type Record2InNullableUnion struct { AString string `avro:"aString"` } diff --git a/gen/testdata/golden_fullname.go b/gen/testdata/golden_fullname.go index ef207ae..5ebcb5f 100644 --- a/gen/testdata/golden_fullname.go +++ b/gen/testdata/golden_fullname.go @@ -1,6 +1,6 @@ package something -// Code generated by avro/gen. DO NOT EDIT MANUALLY. +// Code generated by avro/gen. DO NOT EDIT. import ( "math/big" @@ -9,35 +9,43 @@ import ( "github.com/hamba/avro/v2" ) +// ACInnerRecord is a generated struct. type ACInnerRecord struct { InnerJustBytes []byte `avro:"innerJustBytes"` InnerPrimitiveNullableArrayUnion *[]string `avro:"innerPrimitiveNullableArrayUnion"` } +// ABRecordInMap is a generated struct. type ABRecordInMap struct { Name string `avro:"name"` } +// ABRecordInArray is a generated struct. type ABRecordInArray struct { AString string `avro:"aString"` } +// ABRecordInNullableUnion is a generated struct. type ABRecordInNullableUnion struct { AString string `avro:"aString"` } +// ABRecord1InNonNullableUnion is a generated struct. type ABRecord1InNonNullableUnion struct { AString string `avro:"aString"` } +// ABRecord2InNonNullableUnion is a generated struct. type ABRecord2InNonNullableUnion struct { AString string `avro:"aString"` } +// ABRecord1InNullableUnion is a generated struct. type ABRecord1InNullableUnion struct { AString string `avro:"aString"` } +// ABRecord2InNullableUnion is a generated struct. type ABRecord2InNullableUnion struct { AString string `avro:"aString"` } diff --git a/gen/testdata/golden_multiple.go b/gen/testdata/golden_multiple.go index dcbfd74..34c3f08 100644 --- a/gen/testdata/golden_multiple.go +++ b/gen/testdata/golden_multiple.go @@ -1,12 +1,14 @@ package something -// Code generated by avro/gen. DO NOT EDIT MANUALLY. +// Code generated by avro/gen. DO NOT EDIT. +// TestUnionType is a generated struct. type TestUnionType struct { Field1 int64 `avro:"Field1"` Field2 int `avro:"Field2"` } +// TestMain is a generated struct. type TestMain struct { TestUnion *TestUnionType `avro:"TestUnion"` }