| 1 | package main |
|---|---|
| 2 | |
| 3 | import ( |
| 4 | "lib" // @describe ref-pkg-import "lib" |
| 5 | "lib/sublib" // @describe ref-pkg-import2 "sublib" |
| 6 | ) |
| 7 | |
| 8 | // Tests that import another package. (To make the tests run quickly, |
| 9 | // we avoid using imports in all the other tests. Remember, each |
| 10 | // query causes parsing and typechecking of the whole program.) |
| 11 | // |
| 12 | // See go.tools/guru/guru_test.go for explanation. |
| 13 | // See imports.golden for expected query results. |
| 14 | |
| 15 | var a int |
| 16 | |
| 17 | func main() { |
| 18 | const c = lib.Const // @describe ref-const "Const" |
| 19 | lib.Func() // @describe ref-func "Func" |
| 20 | lib.Var++ // @describe ref-var "Var" |
| 21 | var t lib.Type // @describe ref-type "Type" |
| 22 | p := t.Method(&a) // @describe ref-method "Method" |
| 23 | |
| 24 | print(*p + 1) // @pointsto p "p " |
| 25 | |
| 26 | var _ lib.Type // @describe ref-pkg "lib" |
| 27 | |
| 28 | _ = sublib.C |
| 29 | } |
| 30 |