github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/testdata/script/mod_get_indirect.txt (about) 1 env GO111MODULE=on 2 [short] skip 3 4 # get -u should not upgrade anything, since the package 5 # in the current directory doesn't import anything. 6 go get -u 7 go list -m all 8 stdout 'quote v1.5.1$' 9 grep 'rsc.io/quote v1.5.1$' go.mod 10 11 # get -u should find quote v1.5.2 once there is a use. 12 cp $WORK/tmp/usequote.go x.go 13 go get -u 14 go list -m all 15 stdout 'quote v1.5.2$' 16 grep 'rsc.io/quote v1.5.2$' go.mod 17 18 # it should also update x/text later than requested by v1.5.2 19 go list -m -f '{{.Path}} {{.Version}}{{if .Indirect}} // indirect{{end}}' all 20 stdout '^golang.org/x/text [v0-9a-f\.-]+ // indirect' 21 grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod 22 23 # importing an empty module root as a package does not remove indirect tag. 24 cp $WORK/tmp/usetext.go x.go 25 go list -e 26 grep 'golang.org/x/text v0.3.0 // indirect$' go.mod 27 28 # indirect tag should be removed upon seeing direct import. 29 cp $WORK/tmp/uselang.go x.go 30 go list 31 grep 'rsc.io/quote v1.5.2$' go.mod 32 grep 'golang.org/x/text [v0-9a-f\.-]+$' go.mod 33 34 # indirect tag should be added by go mod tidy 35 cp $WORK/tmp/usequote.go x.go 36 go mod tidy 37 grep 'rsc.io/quote v1.5.2$' go.mod 38 grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod 39 40 # requirement should be dropped entirely if not needed 41 cp $WORK/tmp/uselang.go x.go 42 go mod tidy 43 ! grep rsc.io/quote go.mod 44 grep 'golang.org/x/text [v0-9a-f\.-]+$' go.mod 45 46 -- go.mod -- 47 module x 48 require rsc.io/quote v1.5.1 49 -- x.go -- 50 package x 51 -- $WORK/tmp/usetext.go -- 52 package x 53 import _ "golang.org/x/text" 54 -- $WORK/tmp/uselang.go -- 55 package x 56 import _ "golang.org/x/text/language" 57 -- $WORK/tmp/usequote.go -- 58 package x 59 import _ "rsc.io/quote"