| 1 |
This file checks various handling of comments when adding imports. |
| 2 |
|
| 3 |
-- go.mod -- |
| 4 |
module testdata |
| 5 |
go 1.12 |
| 6 |
|
| 7 |
-- a/empty.go -- |
| 8 |
package a // This is package a. |
| 9 |
|
| 10 |
func _() { |
| 11 |
a() //@ inline(re"a", empty) |
| 12 |
} |
| 13 |
|
| 14 |
-- empty -- |
| 15 |
package a // This is package a. |
| 16 |
|
| 17 |
import "testdata/b" |
| 18 |
|
| 19 |
func _() { |
| 20 |
b.B() //@ inline(re"a", empty) |
| 21 |
} |
| 22 |
-- a/existing.go -- |
| 23 |
package a // This is package a. |
| 24 |
|
| 25 |
// This is an import block. |
| 26 |
import ( |
| 27 |
// This is an import of io. |
| 28 |
"io" |
| 29 |
|
| 30 |
// This is an import of c. |
| 31 |
"testdata/c" // yes, of c |
| 32 |
) |
| 33 |
|
| 34 |
var ( |
| 35 |
// This is an io.Writer. |
| 36 |
_ io.Writer |
| 37 |
// This is c.C |
| 38 |
_ c.C |
| 39 |
) |
| 40 |
|
| 41 |
func _() { |
| 42 |
a() //@ inline(re"a", existing) |
| 43 |
} |
| 44 |
|
| 45 |
-- existing -- |
| 46 |
package a // This is package a. |
| 47 |
|
| 48 |
// This is an import block. |
| 49 |
import ( |
| 50 |
// This is an import of io. |
| 51 |
"io" |
| 52 |
"testdata/b" |
| 53 |
|
| 54 |
// This is an import of c. |
| 55 |
"testdata/c" // yes, of c |
| 56 |
) |
| 57 |
|
| 58 |
var ( |
| 59 |
// This is an io.Writer. |
| 60 |
_ io.Writer |
| 61 |
// This is c.C |
| 62 |
_ c.C |
| 63 |
) |
| 64 |
|
| 65 |
func _() { |
| 66 |
b.B() //@ inline(re"a", existing) |
| 67 |
} |
| 68 |
|
| 69 |
-- a/noparens.go -- |
| 70 |
package a // This is package a. |
| 71 |
|
| 72 |
// This is an import of c. |
| 73 |
import "testdata/c" |
| 74 |
|
| 75 |
func _() { |
| 76 |
var _ c.C |
| 77 |
a() //@ inline(re"a", noparens) |
| 78 |
} |
| 79 |
|
| 80 |
-- noparens -- |
| 81 |
package a // This is package a. |
| 82 |
|
| 83 |
import "testdata/b" |
| 84 |
|
| 85 |
// This is an import of c. |
| 86 |
import "testdata/c" |
| 87 |
|
| 88 |
func _() { |
| 89 |
var _ c.C |
| 90 |
b.B() //@ inline(re"a", noparens) |
| 91 |
} |
| 92 |
|
| 93 |
-- a/a.go -- |
| 94 |
package a |
| 95 |
|
| 96 |
// This is an import of b. |
| 97 |
import "testdata/b" |
| 98 |
|
| 99 |
func a() { |
| 100 |
// This is a call to B. |
| 101 |
b.B() |
| 102 |
} |
| 103 |
|
| 104 |
-- b/b.go -- |
| 105 |
package b |
| 106 |
|
| 107 |
func B() {} |
| 108 |
|
| 109 |
-- c/c.go -- |
| 110 |
package c |
| 111 |
|
| 112 |
type C int |