strconv.Atoi() throwing error when given a string

The error is telling you that the two return values from strconv.Atoi (int and error) are used in a single value context (the assignment to time). Change the code to:

   time, err := strconv.Atoi(times)
   if err != nil {
      // Add code here to handle the error!
   }

Use the blank identifier to ignore the error return value:

   time, _ := strconv.Atoi(times)

Leave a Comment