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

     1  # This test checks that "go mod tidy -e" do not panic when
     2  # using a file goproxy that is missing some modules.
     3  # Verifies golang.org/issue/51589
     4  
     5  # download the modules first
     6  env GO111MODULE=on
     7  env GOPATH=$WORK/gopath
     8  cd $WORK/x
     9  go mod tidy
    10  
    11  # Use download cache as file:/// proxy.
    12  [GOOS:windows] env GOPROXY=file:///$WORK/gopath/pkg/mod/cache/download
    13  [!GOOS:windows] env GOPROXY=file://$WORK/gopath/pkg/mod/cache/download
    14  rm $WORK/gopath/pkg/mod/cache/download/golang.org/x/text/
    15  go mod tidy -e
    16  stderr '^go: rsc.io/sampler@v1.3.0 requires\n\tgolang.org/x/text@.*: reading file://.*/pkg/mod/cache/download/golang.org/x/text/.*'
    17  ! stderr 'signal SIGSEGV: segmentation violation'
    18  
    19  -- $WORK/x/go.mod --
    20  module example.com/mod
    21  
    22  go 1.17
    23  
    24  require rsc.io/quote v1.5.2
    25  
    26  require (
    27  	golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c // indirect
    28  	rsc.io/sampler v1.3.0 // indirect
    29  )
    30  
    31  -- $WORK/x/x.go --
    32  package mod
    33  
    34  import (
    35  	"fmt"
    36  
    37  	"rsc.io/quote"
    38  )
    39  
    40  func Echo() {
    41  	fmt.Println(quote.Hello())
    42  }
    43  

View as plain text