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 / staticcheck / testdata / src / CheckIneffectiveAppend / CheckIneffectiveAppend.go
1 package pkg
2
3 import "fmt"
4
5 func fn1() {
6         var s []int
7         s = append(s, 1) // want `this result of append is never used`
8         s = append(s, 1) // want `this result of append is never used`
9 }
10
11 func fn2() (named []int) {
12         named = append(named, 1)
13         return
14 }
15
16 func fn3() {
17         s := make([]int, 0)
18         s = append(s, 1) // want `this result of append is never used`
19 }
20
21 func fn4() []int {
22         var s []int
23         s = append(s, 1)
24         return s
25 }
26
27 func fn5() {
28         var s []int
29         s = append(s, 1)
30         fn6(s)
31 }
32
33 func fn6([]int) {}
34
35 func fn7() {
36         var s []int
37         fn8(&s)
38         s = append(s, 1)
39 }
40
41 func fn8(*[]int) {}
42
43 func fn9() {
44         var s []int
45         s = append(s, 1)
46         fmt.Println(s)
47         s = append(s, 1) // want `this result of append is never used`
48 }
49
50 func fn10() {
51         var s []int
52         return
53         s = append(s, 1)
54 }
55
56 func fn11() {
57         var s []int
58         for x := 0; x < 10; x++ {
59                 s = append(s, 1) // want `this result of append is never used`
60         }
61 }