...

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

Documentation: cmd/go/testdata/script

     1# Support replace statement in go.work file
     2
     3# Replacement in go.work file, and none in go.mod file.
     4go list -m example.com/dep
     5stdout 'example.com/dep v1.0.0 => ./dep'
     6
     7# Wildcard replacement in go.work file overrides version replacement in go.mod
     8# file.
     9go list -m example.com/other
    10stdout 'example.com/other v1.0.0 => ./other2'
    11
    12-- go.work --
    13use m
    14
    15replace example.com/dep => ./dep
    16replace example.com/other => ./other2
    17
    18-- m/go.mod --
    19module example.com/m
    20
    21require example.com/dep v1.0.0
    22require example.com/other v1.0.0
    23
    24replace example.com/other v1.0.0 => ./other
    25-- m/m.go --
    26package m
    27
    28import "example.com/dep"
    29import "example.com/other"
    30
    31func F() {
    32	dep.G()
    33	other.H()
    34}
    35-- dep/go.mod --
    36module example.com/dep
    37-- dep/dep.go --
    38package dep
    39
    40func G() {
    41}
    42-- other/go.mod --
    43module example.com/other
    44-- other/dep.go --
    45package other
    46
    47func G() {
    48}
    49-- other2/go.mod --
    50module example.com/other
    51-- other2/dep.go --
    52package other
    53
    54func G() {
    55}

View as plain text