go-plist
go-plist copied to clipboard
unmarshal into map with int keys results in panic
Unmarshaling into a map with int keys will result in a panic. Although this key type is expressly forbidden, it would be more friendly to return an error in this case, or at least produce a panic message that's clearer than this:
panic: reflect.Value.Convert: value of type string cannot be converted to type int [recovered]
panic: interface conversion: string is not error: missing method Error
Example code:
https://play.golang.org/p/Qd8TRd2C0LV
Is this error message descriptive enough, or should it be more specific?
=== RUN TestInvalidMapUnmarshal
--- PASS: TestInvalidMapUnmarshal (0.00s)
unmarshal_test.go:59: Error: plist: type mismatch: tried to decode plist type `dictionary'
into value of type `map[int]string'