title: Error handling inside a sort comparator function
body: <p>I have the following code to sort a slice of integer strings by the value of the integers. What would be the way to return the err1 and err2 errors in the sortSlice function, in case the error is not nil? The return of the comparator is used by the sort function, so I'm not sure how to return the error.</p>
  <pre><code>func (o *Object) sortSlice() error {
  
          sort.Slice(mySlice, func(i, j int) bool {
               numA, err1 := strconv.Atoi(mySlice[i])
               numB, err2 := strconv.Atoi(mySlice[j])
               return numA &gt; numB
          })
  }
  </code></pre>