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

     1  # This test exercises that vendoring works properly using the workspace in the
     2  # the work_prune test case.
     3  
     4  go work vendor
     5  cmp vendor/modules.txt modules.txt.want
     6  go list -f '{{with .Module}}{{.Path}}@{{.Version}}{{end}}' all
     7  cmp stdout want_versions
     8  
     9  go list -f '{{.Dir}}' example.com/q
    10  stdout $GOPATH[\\/]src[\\/]vendor[\\/]example.com[\\/]q
    11  go list -f '{{.Dir}}' example.com/b
    12  stdout $GOPATH[\\/]src[\\/]vendor[\\/]example.com[\\/]b
    13  go list -f '{{.Dir}}' example.com/w
    14  stdout $GOPATH[\\/]src[\\/]vendor[\\/]example.com[\\/]w
    15  go list -f '{{.Dir}}' example.com/z
    16  stdout $GOPATH[\\/]src[\\/]vendor[\\/]example.com[\\/]z
    17  
    18  cmp $GOPATH/src/vendor/example.com/q/q.go q1_1_0/q.go
    19  
    20  -- modules.txt.want --
    21  ## workspace
    22  # example.com/b v1.0.0 => ./b
    23  ## explicit; go 1.18
    24  example.com/b
    25  # example.com/q v1.0.0 => ./q1_0_0
    26  ## explicit; go 1.18
    27  # example.com/q v1.1.0 => ./q1_1_0
    28  ## go 1.18
    29  example.com/q
    30  # example.com/w v1.0.0 => ./w
    31  ## go 1.18
    32  example.com/w
    33  # example.com/z v1.0.0 => ./z1_0_0
    34  ## explicit; go 1.18
    35  # example.com/z v1.1.0 => ./z1_1_0
    36  ## go 1.18
    37  example.com/z
    38  # example.com/q v1.0.5 => ./q1_0_5
    39  # example.com/r v1.0.0 => ./r
    40  # example.com/x v1.0.0 => ./x
    41  # example.com/y v1.0.0 => ./y
    42  -- want_versions --
    43  example.com/a@
    44  example.com/b@v1.0.0
    45  example.com/p@
    46  example.com/q@v1.1.0
    47  example.com/w@v1.0.0
    48  example.com/z@v1.1.0
    49  -- go.work --
    50  go 1.18
    51  
    52  use (
    53  	./a
    54  	./p
    55  )
    56  
    57  replace example.com/b v1.0.0 => ./b
    58  replace example.com/q v1.0.0 => ./q1_0_0
    59  replace example.com/q v1.0.5 => ./q1_0_5
    60  replace example.com/q v1.1.0 => ./q1_1_0
    61  replace example.com/r v1.0.0 => ./r
    62  replace example.com/w v1.0.0 => ./w
    63  replace example.com/x v1.0.0 => ./x
    64  replace example.com/y v1.0.0 => ./y
    65  replace example.com/z v1.0.0 => ./z1_0_0
    66  replace example.com/z v1.1.0 => ./z1_1_0
    67  
    68  -- a/go.mod --
    69  module example.com/a
    70  
    71  go 1.18
    72  
    73  require example.com/b v1.0.0
    74  require example.com/z v1.0.0
    75  -- a/foo.go --
    76  package main
    77  
    78  import "example.com/b"
    79  
    80  func main() {
    81  	b.B()
    82  }
    83  -- b/go.mod --
    84  module example.com/b
    85  
    86  go 1.18
    87  
    88  require example.com/q v1.1.0
    89  -- b/b.go --
    90  package b
    91  
    92  func B() {
    93  }
    94  -- p/go.mod --
    95  module example.com/p
    96  
    97  go 1.18
    98  
    99  require example.com/q v1.0.0
   100  
   101  replace example.com/q v1.0.0 => ../q1_0_0
   102  replace example.com/q v1.1.0 => ../q1_1_0
   103  -- p/main.go --
   104  package main
   105  
   106  import "example.com/q"
   107  
   108  func main() {
   109  	q.PrintVersion()
   110  }
   111  -- q1_0_0/go.mod --
   112  module example.com/q
   113  
   114  go 1.18
   115  -- q1_0_0/q.go --
   116  package q
   117  
   118  import "fmt"
   119  
   120  func PrintVersion() {
   121  	fmt.Println("version 1.0.0")
   122  }
   123  -- q1_0_5/go.mod --
   124  module example.com/q
   125  
   126  go 1.18
   127  
   128  require example.com/r v1.0.0
   129  -- q1_0_5/q.go --
   130  package q
   131  
   132  import _ "example.com/r"
   133  -- q1_1_0/go.mod --
   134  module example.com/q
   135  
   136  require example.com/w v1.0.0
   137  require example.com/z v1.1.0
   138  
   139  go 1.18
   140  -- q1_1_0/q.go --
   141  package q
   142  
   143  import _ "example.com/w"
   144  import _ "example.com/z"
   145  
   146  import "fmt"
   147  
   148  func PrintVersion() {
   149  	fmt.Println("version 1.1.0")
   150  }
   151  -- r/go.mod --
   152  module example.com/r
   153  
   154  go 1.18
   155  
   156  require example.com/r v1.0.0
   157  -- r/r.go --
   158  package r
   159  -- w/go.mod --
   160  module example.com/w
   161  
   162  go 1.18
   163  
   164  require example.com/x v1.0.0
   165  -- w/w.go --
   166  package w
   167  -- w/w_test.go --
   168  package w
   169  
   170  import _ "example.com/x"
   171  -- x/go.mod --
   172  module example.com/x
   173  
   174  go 1.18
   175  -- x/x.go --
   176  package x
   177  -- x/x_test.go --
   178  package x
   179  import _ "example.com/y"
   180  -- y/go.mod --
   181  module example.com/y
   182  
   183  go 1.18
   184  -- y/y.go --
   185  package y
   186  -- z1_0_0/go.mod --
   187  module example.com/z
   188  
   189  go 1.18
   190  
   191  require example.com/q v1.0.5
   192  -- z1_0_0/z.go --
   193  package z
   194  
   195  import _ "example.com/q"
   196  -- z1_1_0/go.mod --
   197  module example.com/z
   198  
   199  go 1.18
   200  -- z1_1_0/z.go --
   201  package z
   202  

View as plain text