github.com/zxy12/go_duplicate_112_new@v0.0.0-20200807091221-747231827200/src/cmd/go/testdata/script/mod_get_indirect.txt (about) 1 env GO111MODULE=on 2 3 # get -u should find quote v1.5.2 4 go get -u 5 go list -m all 6 stdout 'quote v1.5.2$' 7 grep 'rsc.io/quote v1.5.2$' go.mod 8 9 # it should also update x/text later than requested by v1.5.2 10 go list -m -f '{{.Path}} {{.Version}}{{if .Indirect}} // indirect{{end}}' all 11 stdout '^golang.org/x/text [v0-9a-f\.-]+ // indirect' 12 grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod 13 14 # importing an empty module root as a package makes it direct. 15 # TODO(bcmills): This doesn't seem correct. Fix is in the next change. 16 cp $WORK/tmp/usetext.go x.go 17 go list -e 18 grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod 19 20 # indirect tag should be removed upon seeing direct import. 21 cp $WORK/tmp/uselang.go x.go 22 go list 23 grep 'rsc.io/quote v1.5.2$' go.mod 24 grep 'golang.org/x/text [v0-9a-f\.-]+$' go.mod 25 26 # indirect tag should be added by go mod tidy 27 cp $WORK/tmp/usequote.go x.go 28 go mod tidy 29 grep 'rsc.io/quote v1.5.2$' go.mod 30 grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod 31 32 # requirement should be dropped entirely if not needed 33 cp $WORK/tmp/uselang.go x.go 34 go mod tidy 35 ! grep rsc.io/quote go.mod 36 grep 'golang.org/x/text [v0-9a-f\.-]+$' go.mod 37 38 -- go.mod -- 39 module x 40 require rsc.io/quote v1.5.1 41 -- x.go -- 42 package x 43 -- $WORK/tmp/usetext.go -- 44 package x 45 import _ "golang.org/x/text" 46 -- $WORK/tmp/uselang.go -- 47 package x 48 import _ "golang.org/x/text/language" 49 -- $WORK/tmp/usequote.go -- 50 package x 51 import _ "rsc.io/quote"