...

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

Documentation: cmd/go/testdata/script

     1# Test go mod download, why, and graph work in workspace mode.
     2# TODO(bcmills): clarify the interaction with #44435
     3
     4go mod download rsc.io/quote
     5exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.info
     6exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.mod
     7exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.zip
     8! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.info
     9! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.mod
    10grep '^rsc\.io/quote v1\.5\.2/go\.mod h1:' go.work.sum
    11grep '^rsc\.io/quote v1\.5\.2 h1:' go.work.sum
    12
    13go clean -modcache
    14rm go.work.sum
    15go mod download
    16exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.info
    17exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.mod
    18exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.zip
    19! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.info
    20! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.mod
    21grep '^rsc\.io/quote v1\.5\.2/go\.mod h1:' go.work.sum
    22grep '^rsc\.io/quote v1\.5\.2 h1:' go.work.sum
    23
    24go mod why rsc.io/quote
    25stdout '# rsc.io/quote\nexample.com/a\nrsc.io/quote'
    26
    27go mod graph
    28stdout 'example.com/a rsc.io/quote@v1.5.2\nexample.com/b example.com/c@v1.0.0\nrsc.io/quote@v1.5.2 rsc.io/sampler@v1.3.0\nrsc.io/sampler@v1.3.0 golang.org/x/text@v0.0.0-20170915032832-14c0d48ead0c'
    29
    30-- go.work --
    31go 1.18
    32
    33use (
    34	./a
    35	./b
    36)
    37-- a/go.mod --
    38go 1.18
    39
    40module example.com/a
    41
    42require "rsc.io/quote" v1.5.2
    43-- a/main.go --
    44package main
    45
    46import (
    47	"fmt"
    48	"rsc.io/quote"
    49)
    50
    51func main() {
    52	fmt.Println(quote.Hello())
    53}
    54-- b/go.mod --
    55go 1.18
    56
    57module example.com/b
    58
    59require example.com/c v1.0.0
    60replace example.com/c => ../c
    61-- c/go.mod --
    62go 1.18
    63
    64module example.com/c
    65

View as plain text