Created
April 6, 2018 20:38
-
-
Save jcoyne/f3bf8d3eef727cf1dda5413eb34298b2 to your computer and use it in GitHub Desktop.
Cast version to an integer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The version is json.Number, but we want it as an integer: | |
if dataMap["version"] != nil { | |
i64, err := dataMap["version"].(json.Number).Int64() | |
if err != nil { | |
panic(err) | |
} | |
dataMap["version"] = int(i64) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment