Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.0.1-2020.1.5 / simple / testdata / src / CheckSortHelpers / LintSortHelpers.go
1 package pkg
2
3 import "sort"
4
5 type MyIntSlice []int
6
7 func (s MyIntSlice) Len() int           { return 0 }
8 func (s MyIntSlice) Less(i, j int) bool { return true }
9 func (s MyIntSlice) Swap(i, j int)      {}
10
11 func fn1() {
12         var a []int
13         sort.Sort(sort.IntSlice(a)) // want `sort\.Ints`
14 }
15
16 func fn2() {
17         var b []float64
18         sort.Sort(sort.Float64Slice(b)) // want `sort\.Float64s`
19 }
20
21 func fn3() {
22         var c []string
23         sort.Sort(sort.StringSlice(c)) // want `sort\.Strings`
24 }
25
26 func fn4() {
27         var a []int
28         sort.Sort(MyIntSlice(a))
29 }
30
31 func fn5() {
32         var d MyIntSlice
33         sort.Sort(d)
34 }
35
36 func fn6() {
37         var e sort.Interface
38         sort.Sort(e)
39 }
40
41 func fn7() {
42         // Don't recommend sort.Ints when there was another legitimate
43         // sort.Sort call already
44         var a []int
45         var e sort.Interface
46         sort.Sort(e)
47         sort.Sort(sort.IntSlice(a))
48 }
49
50 func fn8() {
51         var a []int
52         sort.Sort(sort.IntSlice(a)) // want `sort\.Ints`
53         sort.Sort(sort.IntSlice(a)) // want `sort\.Ints`
54 }
55
56 func fn9() {
57         func() {
58                 var a []int
59                 sort.Sort(sort.IntSlice(a)) // want `sort\.Ints`
60         }()
61 }
62
63 func fn10() {
64         var a MyIntSlice
65         sort.Sort(sort.IntSlice(a)) // want `sort\.Ints`
66 }