Skip to content

sort-non-slice

Detect sort.Slice calls with non-slice values.

Updated View as Markdown

Default severity: error

sort.Slice, sort.SliceStable, and sort.SliceIsSorted accept any only for historical API reasons. The value must hold a slice; passing an array or another concrete type panics at runtime.

Bad

sort.Slice(array, less)

Good

sort.Slice(values, less)
Navigation

Type to search…

↑↓ navigate↵ selectEsc close