conf icon indicating copy to clipboard operation
conf copied to clipboard

Added type switch and casting of float64 numbers to int in Int()

Open pengux opened this issue 11 years ago • 2 comments
trafficstars

Fix issue #2

pengux avatar Feb 21 '14 20:02 pengux

Do you know the type when you call it? I would expect people call something like conf.Float(key) instead of conf.Int(key)

owenthereal avatar Mar 03 '14 14:03 owenthereal

Yes, the type is float64 when you unmarshal from JSON data for all numbers, both for integers and floats. I think it is correct to call conf.Int(key) if you know that it should be an integer.

pengux avatar Mar 03 '14 14:03 pengux