| 1 |
# Test that duplicate imports--and, more generally, duplicate |
| 2 |
# identical insertions--are coalesced. |
| 3 |
|
| 4 |
checker -marker -fix -v example.com/a |
| 5 |
stderr applied 2 fixes, updated 1 file |
| 6 |
exit 0 |
| 7 |
|
| 8 |
-- go.mod -- |
| 9 |
module example.com |
| 10 |
go 1.22 |
| 11 |
|
| 12 |
-- a/a.go -- |
| 13 |
package a |
| 14 |
|
| 15 |
import ( |
| 16 |
_ "errors" |
| 17 |
//@ fix1("()//", `"foo"`), fix2("()//", `"foo"`) |
| 18 |
) |
| 19 |
|
| 20 |
func f() {} //@ fix1("()}", "n++"), fix2("()}", "n++") |
| 21 |
|
| 22 |
-- want/a/a.go -- |
| 23 |
package a |
| 24 |
|
| 25 |
import ( |
| 26 |
_ "errors" |
| 27 |
"foo" //@ fix1("()//", `"foo"`), fix2("()//", `"foo"`) |
| 28 |
) |
| 29 |
|
| 30 |
func f() { n++ } //@ fix1("()}", "n++"), fix2("()}", "n++") |