One of the more interesting custom formats used in this data is dates. It's a format known as decimal dates. They look like as follows:
2018.5
What this means is that this date represents the halfway point of the year 2018. There are 365 days in 2018. The 50% mark would be 183 days into the year: July 3 2018.
We can translate this logic into the following code:
// parseDecimalDate takes a string in format of a decimal date// "2018.05" and converts it into a date.//func parseDecimalDate(a string, loc *time.Location) (time.Time, error) { split := strings.Split(a, ".") if len(split) != 2 { return time.Time{}, errors.Errorf("Unable to split %q into a year followed by a decimal", a) } year, err := strconv.Atoi(split[0]) ...