The avrogo code generator produces non-idiomatic Go struct field names when Avro schema fields contain underscores. It preserves underscores in field names (e.g., Event_type) instead of converting to proper PascalCase (e.g., EventType).
{
"type": "record",
"name": "TestEvent",
"namespace": "test.events",
"fields": [
{
"name": "event_type",
"type": "string"
},
{
"name": "user_id",
"type": "string"
}
]
}
generates
type TestEvent struct {
Event_type string json:"event_type"
User_id string json:"user_id"
}
not
type TestEvent struct {
EventType string json:"event_type"
UserId string json:"user_id"
}
save the exampel schema to disk and run
avrogo -p test test_event.avsc