| 1 |
This test demonstrates diagnostics for a module that is missing from the |
| 2 |
go.work file. |
| 3 |
|
| 4 |
Quick-fixes change files on disk, so are tested by integration tests. |
| 5 |
|
| 6 |
-- skip -- |
| 7 |
Temporary skip due to golang/go#57979, with zero-config gopls, these modules |
| 8 |
are no longer orphaned. |
| 9 |
|
| 10 |
-- go.work -- |
| 11 |
go 1.21 |
| 12 |
|
| 13 |
use ( |
| 14 |
./a |
| 15 |
) |
| 16 |
|
| 17 |
-- a/go.mod -- |
| 18 |
module mod.com/a |
| 19 |
|
| 20 |
go 1.18 |
| 21 |
|
| 22 |
-- a/main.go -- |
| 23 |
package main |
| 24 |
|
| 25 |
import "mod.com/a/lib" |
| 26 |
|
| 27 |
func main() { |
| 28 |
_ = lib.C |
| 29 |
} |
| 30 |
|
| 31 |
-- a/lib/lib.go -- |
| 32 |
package lib |
| 33 |
|
| 34 |
const C = "b" |
| 35 |
-- b/go.mod -- |
| 36 |
module mod.com/b |
| 37 |
|
| 38 |
go 1.18 |
| 39 |
|
| 40 |
-- b/main.go -- |
| 41 |
package main //@diag("main", re"add this module to your go.work") |
| 42 |
|
| 43 |
import "mod.com/b/lib" //@diag("\"mod.com", re"not included in a workspace module") |
| 44 |
|
| 45 |
func main() { |
| 46 |
_ = lib.C |
| 47 |
} |
| 48 |
|
| 49 |
-- b/lib/lib.go -- |
| 50 |
package lib //@diag("lib", re"add this module to your go.work") |
| 51 |
|
| 52 |
const C = "b" |