Golang go/scanner.ErrorList.Sort() function example

package go/scanner

Sort sorts an ErrorList. *Error entries are sorted by position, other errors are sorted by error message, and before any *Error entry.

Golang go/scanner.ErrorList.Sort() function usage example

 list.Sort()
 if len(list) != 9 {
 t.Errorf("found %d sorted errors, expected 9", len(list))
 PrintError(os.Stderr, list)
 }

Reference :

http://golang.org/pkg/go/scanner/#ErrorList.Sort

Advertisement