I'd expect the following test to succeed, but it doesn't. This is caused by the way float64 values are converted to integers in the current implementation. The tests demonstrates why json.Unmarshall probably chooses to unmarshall all numeric json values to float64 when unmarshalling to an interface.
A possible fix that could still support MustInt() etc. could be to do the conversion in the MustInt() methods. That way the expected float64 behaviour would persist, but integers could still be supported for ease of use.
I'd expect the following test to succeed, but it doesn't. This is caused by the way float64 values are converted to integers in the current implementation. The tests demonstrates why
json.Unmarshall
probably chooses to unmarshall all numeric json values to float64 when unmarshalling to an interface.A possible fix that could still support
MustInt()
etc. could be to do the conversion in theMustInt()
methods. That way the expected float64 behaviour would persist, but integers could still be supported for ease of use.