-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Hi there!
I'm finding that using marshal and unmarshal on an empty slice in a struct turns that value into a nil, which seems incorrect, given that I believe the Avro spec supports empty values. e.g.
func TestAvroEmpty(t *testing.T) {
a := assert.New(t)
type A struct {
EmptySlice []string
}
mockA := A{
EmptySlice: []string{},
}
marshalA, schemaA, err := avro.Marshal(mockA)
a.Nil(err)
var newA A
_, err = avro.Unmarshal(marshalA, &newA, schemaA)
a.Nil(err)
diff := cmp.Diff(mockA, newA)
a.Empty(diff)
}
yields the output:
=== RUN TestA
...
Error: Should be empty, but was A{
- EmptySlice: []string{},
+ EmptySlice: nil,
}
Test: TestA
--- FAIL: TestA (0.00s)
Is this expected behavior for the library?
Metadata
Metadata
Assignees
Labels
No labels