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 / CheckWithValueKey / CheckWithValueKey.go
1 package pkg
2
3 import "context"
4
5 type T string
6
7 type T2 struct {
8         A int
9 }
10
11 type T3 struct {
12         A []int
13 }
14
15 func fn(arg1 interface{}, arg2 string) {
16         var ctx context.Context
17         context.WithValue(ctx, "hi", nil) // want `should not use built-in type string`
18         context.WithValue(ctx, arg1, nil)
19         context.WithValue(ctx, arg2, nil) // want `should not use built-in type string`
20         v1 := interface{}("byte")
21         context.WithValue(ctx, v1, nil) // want `should not use built-in type string`
22
23         var key T
24         context.WithValue(ctx, key, nil)
25         v2 := interface{}(key)
26         context.WithValue(ctx, v2, nil)
27         context.WithValue(ctx, T(""), nil)
28         context.WithValue(ctx, string(key), nil) // want `should not use built-in type string`
29
30         context.WithValue(ctx, []byte(nil), nil) // want `must be comparable`
31         context.WithValue(ctx, T2{}, nil)
32         context.WithValue(ctx, T3{}, nil) // want `must be comparable`
33 }