github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/testdata/script/mod_why.txt (about) 1 env GO111MODULE=on 2 [short] skip 3 4 go list -test all 5 stdout rsc.io/quote 6 stdout golang.org/x/text/language 7 8 # why a package? 9 go mod why golang.org/x/text/language 10 cmp stdout why-language.txt 11 12 # why a module? 13 go mod why -m golang.org... 14 cmp stdout why-text-module.txt 15 16 # why a package used only in tests? 17 go mod why rsc.io/testonly 18 cmp stdout why-testonly.txt 19 20 # why a module used only in tests? 21 go mod why -m rsc.io/testonly 22 cmp stdout why-testonly.txt 23 24 # test package not needed 25 go mod why golang.org/x/text/unused 26 cmp stdout why-unused.txt 27 28 # vendor doesn't use packages used only in tests. 29 go mod why -vendor rsc.io/testonly 30 cmp stdout why-vendor.txt 31 32 # vendor doesn't use modules used only in tests. 33 go mod why -vendor -m rsc.io/testonly 34 cmp stdout why-vendor-module.txt 35 36 # test multiple packages 37 go mod why golang.org/x/text/language golang.org/x/text/unused 38 cmp stdout why-both.txt 39 40 # test multiple modules 41 go mod why -m rsc.io/quote rsc.io/sampler 42 cmp stdout why-both-module.txt 43 44 -- go.mod -- 45 module mymodule 46 require rsc.io/quote v1.5.2 47 48 -- x/x.go -- 49 package x 50 import _ "mymodule/z" 51 52 -- y/y.go -- 53 package y 54 55 -- y/y_test.go -- 56 package y 57 import _ "rsc.io/quote" 58 59 -- z/z.go -- 60 package z 61 import _ "mymodule/y" 62 63 64 -- why-language.txt -- 65 # golang.org/x/text/language 66 mymodule/y 67 mymodule/y.test 68 rsc.io/quote 69 rsc.io/sampler 70 golang.org/x/text/language 71 -- why-unused.txt -- 72 # golang.org/x/text/unused 73 (main module does not need package golang.org/x/text/unused) 74 -- why-text-module.txt -- 75 # golang.org/x/text 76 mymodule/y 77 mymodule/y.test 78 rsc.io/quote 79 rsc.io/sampler 80 golang.org/x/text/language 81 -- why-testonly.txt -- 82 # rsc.io/testonly 83 mymodule/y 84 mymodule/y.test 85 rsc.io/quote 86 rsc.io/sampler 87 rsc.io/sampler.test 88 rsc.io/testonly 89 -- why-vendor.txt -- 90 # rsc.io/testonly 91 (main module does not need to vendor package rsc.io/testonly) 92 -- why-vendor-module.txt -- 93 # rsc.io/testonly 94 (main module does not need to vendor module rsc.io/testonly) 95 -- why-both.txt -- 96 # golang.org/x/text/language 97 mymodule/y 98 mymodule/y.test 99 rsc.io/quote 100 rsc.io/sampler 101 golang.org/x/text/language 102 103 # golang.org/x/text/unused 104 (main module does not need package golang.org/x/text/unused) 105 -- why-both-module.txt -- 106 # rsc.io/quote 107 mymodule/y 108 mymodule/y.test 109 rsc.io/quote 110 111 # rsc.io/sampler 112 mymodule/y 113 mymodule/y.test 114 rsc.io/quote 115 rsc.io/sampler