Debian Codegraph @

staticcheck/sa1019/testdata/go1.0/CheckDeprecated/CheckDeprecated.go

raw
1 // Deprecated: this package is deprecated.
2 package pkg
3
4 import _ "example.com/CheckDeprecated.assist" //@ diag(`Alas, it is deprecated.`)
5 import _ "example.com/AnotherCheckDeprecated.assist" //@ diag(`Alas, it is deprecated.`)
6 import foo "example.com/AnotherCheckDeprecated.assist" //@ diag(`Alas, it is deprecated.`)
7 import "example.com/AnotherCheckDeprecated.assist" //@ diag(`Alas, it is deprecated.`)
8 import ae "example.com/CheckDeprecated.assist_external"
9
10 func init() {
11 foo.Fn()
12 AnotherCheckDeprecatedassist.Fn()
13
14 // Field is deprecated, but we're using it from the same package, which is fine.
15 var s S
16 _ = s.Field
17
18 s2 := ae.SD{
19 D: "used", //@ diag(`external don't use me`)
20 }
21 _ = s2
22 // Struct with the same name should not be flagged
23 s3 := ae.SN{
24 D:"also",
25 }
26 _ = s3
27 // Other Key-Value expressions should be safely ignored
28 _ = map[string]string {
29 "left":"right",
30 }
31 }
32
33
34 type S struct {
35 // Deprecated: this is deprecated.
36 Field int
37 }