github.com/megatontech/mynoteforgo@v0.0.0-20200507084910-5d0c6ea6e890/源码/cmd/go/testdata/script/mod_list_dir.txt (about) 1 # go list with path to directory should work 2 3 env GO111MODULE=off 4 go list -f '{{.ImportPath}}' $GOROOT/src/math 5 stdout ^math$ 6 7 env GO111MODULE=on 8 go list -f '{{.ImportPath}}' $GOROOT/src/math 9 stdout ^math$ 10 go list -f '{{.ImportPath}}' . 11 stdout ^x$ 12 ! go list -f '{{.ImportPath}}' $GOPATH/pkg/mod/rsc.io/quote@v1.5.2 13 stderr 'unknown import path "rsc.io/quote": cannot find package' 14 go list -e -f '{{with .Error}}{{.}}{{end}}' $GOPATH/pkg/mod/rsc.io/quote@v1.5.2 15 stdout 'unknown import path "rsc.io/quote": cannot find package' 16 go mod download rsc.io/quote@v1.5.2 17 go list -f '{{.ImportPath}}' $GOPATH/pkg/mod/rsc.io/quote@v1.5.2 18 stdout '^rsc.io/quote$' 19 go list -f '{{.ImportPath}}' $GOPATH/pkg/mod/rsc.io/sampler@v1.3.0 20 stdout '^rsc.io/sampler$' 21 go get -d rsc.io/sampler@v1.3.1 22 go list -f '{{.ImportPath}}' $GOPATH/pkg/mod/rsc.io/sampler@v1.3.1 23 stdout '^rsc.io/sampler$' 24 ! go list -f '{{.ImportPath}}' $GOPATH/pkg/mod/rsc.io/sampler@v1.3.0 25 stderr 'outside available modules' 26 27 -- go.mod -- 28 module x 29 require rsc.io/quote v1.5.2 30 31 -- x.go -- 32 package x