Debian Codegraph @

unused/testdata/src/example.com/alias/alias.go

raw
1 package main
2
3 import "net/http"
4
5 type t1 struct{} //@ used("t1", true)
6 type t2 struct{} //@ used("t2", false)
7 type t3 struct{} //@ used("t3", true)
8
9 type alias1 = t1 //@ used("alias1", true)
10 type alias2 = t2 //@ used("alias2", false)
11 type alias3 = t3 //@ used("alias3", false)
12 type alias4 = int //@ used("alias4", false)
13
14 func main() { //@ used("main", true)
15 var _ alias1 //@ used("_", true)
16 var _ t3 //@ used("_", true)
17 }
18
19 type t4 struct { //@ used("t4", true)
20 x int //@ used("x", true)
21 }
22
23 func (t4) foo() {} //@ used("foo", true)
24
25 //lint:ignore U1000 alias5 is ignored, which also ignores t4
26 type alias5 = t4 //@ used("alias5", true)
27
28 //lint:ignore U1000 alias6 is ignored, and we don't incorrectly try to include http.Server's fields and methods in the graph
29 type alias6 = http.Server //@ used("alias6", true)
30
31 //lint:ignore U1000 aliases don't have to be to named types
32 type alias7 = struct { //@ used("alias7", true)
33 x int //@ used("x", true)
34 }