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

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

View as plain text