actgardner / gogen-avro

Generate Go code to serialize and deserialize Avro schemas
MIT License
365 stars 85 forks source link

Error with escaped character #164

Closed shiyao-afterpay closed 3 years ago

shiyao-afterpay commented 3 years ago

The following fails: example.avsc

{
  "type" : "record",
  "name" : "foobar",
  "fields" : [ {
    "name" : "foobar",
    "type" : "long",
    "doc" : "\n,",
    "default" : 0
  }]
}

gogen-avro output example.avsc

Error writing source files to directory "output" - Error writing file output/foobar.go - 18:1: expected '}', found ',' (and 1 more errors)

Problem occurs due to the \n escaped char. This example.avsc is generated from the avdl with the official java tools. So it shall be valid itself.

shiyao-afterpay commented 3 years ago

@actgardner thoughts on this?

actgardner commented 3 years ago

@shiyao-afterpay Thanks for reporting this issue! It should be fixed in the version I just released (v7.3.1)