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