...

Text file src/cmd/go/testdata/script/work_overlay.txt

Documentation: cmd/go/testdata/script

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

View as plain text