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

     1  # Test of go work sync in a workspace in which some dependency in the build
     2  # list of 'b' (but not otherwise needed by `b`, so not seen when lazy loading
     3  # occurs) actually is relevant to `a`.
     4  #
     5  # a -> p 1.0
     6  # b -> q 1.1 -> p 1.1
     7  go work sync
     8  cmp a/go.mod a/want_go.mod
     9  cmp b/go.mod b/want_go.mod
    10  
    11  -- go.work --
    12  go 1.18
    13  
    14  use (
    15  	./a
    16  	./b
    17  )
    18  
    19  -- a/go.mod --
    20  go 1.18
    21  
    22  module example.com/a
    23  
    24  require (
    25  	example.com/p v1.0.0
    26  )
    27  
    28  replace (
    29  	example.com/p => ../p
    30  )
    31  -- a/want_go.mod --
    32  go 1.18
    33  
    34  module example.com/a
    35  
    36  require example.com/p v1.1.0
    37  
    38  replace example.com/p => ../p
    39  -- a/a.go --
    40  package a
    41  
    42  import (
    43  	"example.com/p"
    44  )
    45  
    46  func Foo() {
    47  	p.P()
    48  }
    49  -- b/go.mod --
    50  go 1.18
    51  
    52  module example.com/b
    53  
    54  require (
    55  	example.com/q v1.1.0
    56  )
    57  
    58  replace (
    59  	example.com/q => ../q
    60  )
    61  -- b/want_go.mod --
    62  go 1.18
    63  
    64  module example.com/b
    65  
    66  require (
    67  	example.com/q v1.1.0
    68  )
    69  
    70  replace (
    71  	example.com/q => ../q
    72  )
    73  -- b/b.go --
    74  package b
    75  
    76  import (
    77  	"example.com/q"
    78  )
    79  
    80  func Foo() {
    81  	q.Q()
    82  }
    83  -- p/go.mod --
    84  go 1.18
    85  
    86  module example.com/p
    87  -- p/p.go --
    88  package p
    89  
    90  func P() {}
    91  -- q/go.mod --
    92  go 1.18
    93  
    94  module example.com/q
    95  
    96  require example.com/p v1.1.0
    97  
    98  replace example.com/p => ../p
    99  -- q/q.go --
   100  package q
   101  
   102  import example.com/p
   103  
   104  func Q() {
   105  	p.P()
   106  }
   107  

View as plain text