| 1 |
# Test that overlays are respected when opening go.work files. |
| 2 |
|
| 3 |
# go.work in overlay, but not on disk. |
| 4 |
go list -overlay=overlay.json -m |
| 5 |
stdout example.com/a |
| 6 |
stdout example.com/b |
| 7 |
! stdout example.com/c |
| 8 |
|
| 9 |
# control case for go.work on disk and in overlay: |
| 10 |
# go.work is on disk but not in overlay. |
| 11 |
cp go.work.non-overlay go.work |
| 12 |
go list -m |
| 13 |
stdout example.com/a |
| 14 |
stdout example.com/b |
| 15 |
stdout example.com/c |
| 16 |
|
| 17 |
# go.work on disk and in overlay. |
| 18 |
go list -overlay=overlay.json -m |
| 19 |
stdout example.com/a |
| 20 |
stdout example.com/b |
| 21 |
! stdout example.com/c |
| 22 |
|
| 23 |
-- overlay.json -- |
| 24 |
{"Replace": {"go.work": "overlaywork"}} |
| 25 |
-- overlaywork -- |
| 26 |
use ( |
| 27 |
./a |
| 28 |
./b |
| 29 |
) |
| 30 |
-- go.work.non-overlay -- |
| 31 |
use ( |
| 32 |
./a |
| 33 |
./b |
| 34 |
./c |
| 35 |
) |
| 36 |
-- a/go.mod -- |
| 37 |
module example.com/a |
| 38 |
-- b/go.mod -- |
| 39 |
module example.com/b |
| 40 |
-- c/go.mod -- |
| 41 |
module example.com/c |