blob: 7964c914a2c5a25aae95ae75c0d705ff02aad451 [file] [log] [blame]
Dan Willemsenbc60c3c2021-12-15 01:09:00 -08001# 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
10
11go mod download
12exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.info
13exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.mod
14exists $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
18go mod why rsc.io/quote
19stdout '# rsc.io/quote\nexample.com/a\nrsc.io/quote'
20
21go mod graph
22stdout '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 --
25go 1.18
26
27use (
28 ./a
29 ./b
30)
31-- a/go.mod --
32go 1.18
33
34module example.com/a
35
36require "rsc.io/quote" v1.5.2
37-- a/main.go --
38package main
39
40import (
41 "fmt"
42 "rsc.io/quote"
43)
44
45func main() {
46 fmt.Println(quote.Hello())
47}
48-- b/go.mod --
49go 1.18
50
51module example.com/b
52
53require example.com/c v1.0.0
54replace example.com/c => ../c
55-- c/go.mod --
56go 1.18
57
58module example.com/c
59