Skip to content

Commit

Permalink
Strip newlines from go comments
Browse files Browse the repository at this point in the history
  • Loading branch information
actgardner committed Mar 1, 2021
1 parent d3fd7f0 commit 46bd444
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion v7/schema/enum.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (e *EnumDefinition) Name() string {
}

func (e *EnumDefinition) Doc() string {
return e.doc
return strings.ReplaceAll(e.doc, "\n", " ")
}

func (e *EnumDefinition) AvroName() QualifiedName {
Expand Down
3 changes: 2 additions & 1 deletion v7/schema/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package schema

import (
"fmt"
"strings"

"github.com/actgardner/gogen-avro/v7/generator"
)
Expand Down Expand Up @@ -66,7 +67,7 @@ func (f *Field) Index() int {
}

func (f *Field) Doc() string {
return f.doc
return strings.ReplaceAll(f.doc, "\n", " ")
}

// Tags returns a field go struct tags if defined.
Expand Down
3 changes: 2 additions & 1 deletion v7/schema/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package schema
import (
"encoding/json"
"fmt"
"strings"

"github.com/actgardner/gogen-avro/v7/generator"
)
Expand Down Expand Up @@ -146,7 +147,7 @@ func (s *RecordDefinition) WrapperType() string {
}

func (s *RecordDefinition) Doc() string {
return s.doc
return strings.ReplaceAll(s.doc, "\n", " ")
}

func (s *RecordDefinition) Schema() (string, error) {
Expand Down
2 changes: 1 addition & 1 deletion v7/test/enum/enum.avsc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": {
"name": "TestEnumType",
"type": "enum",
"doc": "Test enum",
"doc": "Test \nenum",
"symbols": ["TestSymbol1", "testSymbol2", "testSymbol3"]
},
"default": "testSymbol3"
Expand Down
2 changes: 1 addition & 1 deletion v7/test/enum/enum_test_record.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion v7/test/enum/test_enum_type.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion v7/test/primitive/primitive_test_record.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion v7/test/primitive/primitives.avsc
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"type": "record",
"name": "PrimitiveTestRecord",
"doc": "primitive\nrecord",
"fields": [
{"name": "IntField", "type": "int"},
{"name": "IntField", "type": "int", "doc": "int\nfield"},
{"name": "LongField", "type": "long"},
{"name": "FloatField", "type": "float"},
{"name": "DoubleField", "type": "double"},
Expand Down

0 comments on commit 46bd444

Please sign in to comment.