Skip to content

sort-conversion-without-sort

Detect slice type conversions mistaken for sorting calls.

Updated View as Markdown

Default severity: warning

sort.Float64Slice, sort.IntSlice, and sort.StringSlice are types, not sorting functions. Converting a slice to one of these types and assigning it back does not reorder any values.

Bad

values = sort.IntSlice(values)

Good

sort.Ints(values)
Navigation

Type to search…

↑↓ navigate↵ selectEsc close