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

     1  # 'go work sync' must write go.sum files that are complete for each module on
     2  # its own, including the go.mod hashes of the versions it upgrades to.
     3  
     4  go -C a mod tidy
     5  go -C b mod tidy
     6  grep '^rsc.io/quote v1.0.0/go.mod ' b/go.sum
     7  
     8  # go work sync upgrades b to quote v1.1.0, which a already uses.
     9  go work sync
    10  grep '^rsc.io/quote v1.1.0 h1:' b/go.sum
    11  grep '^rsc.io/quote v1.1.0/go.mod ' b/go.sum
    12  
    13  # ... so b still builds outside the workspace.
    14  env GOWORK=off
    15  go -C b build ./...
    16  
    17  -- go.work --
    18  go 1.21
    19  
    20  use (
    21  	./a
    22  	./b
    23  )
    24  -- a/go.mod --
    25  module example.com/a
    26  
    27  go 1.21
    28  
    29  require rsc.io/quote v1.1.0
    30  -- a/a.go --
    31  package a
    32  
    33  import _ "rsc.io/quote"
    34  -- b/go.mod --
    35  module example.com/b
    36  
    37  go 1.21
    38  
    39  require rsc.io/quote v1.0.0
    40  -- b/b.go --
    41  package b
    42  
    43  import _ "rsc.io/quote"
    44  

View as plain text