This function can be vastly simplified with the use of fmt.Sscanf, to two lines, plus maybe error-checking boilerplate.