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

     1  # This is a test that if one of the main modules replaces the other
     2  # the vendor consistency checks still pass. The replacement is ignored
     3  # because it is of a main module, but it is still recorded in
     4  # vendor/modules.txt.
     5  
     6  go work vendor
     7  go list all # make sure the consistency checks pass
     8  ! stderr .
     9  
    10  # Removing the replace causes consistency checks to fail
    11  cp a_go_mod_no_replace a/go.mod
    12  ! go list all # consistency checks fail
    13  stderr 'example.com/b@v0.0.0: is marked as replaced in vendor/modules.txt, but not replaced in the workspace'
    14  
    15  
    16  -- a_go_mod_no_replace --
    17  module example.com/a
    18  
    19  go 1.21
    20  
    21  require example.com/b v0.0.0
    22  -- go.work --
    23  go 1.21
    24  
    25  use (
    26      a
    27      b
    28  )
    29  -- a/go.mod --
    30  module example.com/a
    31  
    32  go 1.21
    33  
    34  require example.com/b v0.0.0
    35  
    36  replace example.com/b => ../b
    37  -- a/a.go --
    38  package a
    39  
    40  import _ "example.com/b"
    41  -- b/go.mod --
    42  module example.com/b
    43  
    44  go 1.21
    45  -- b/b.go --
    46  package b

View as plain text