github.com/megatontech/mynoteforgo@v0.0.0-20200507084910-5d0c6ea6e890/源码/cmd/go/testdata/script/mod_get_commit.txt (about) 1 env GO111MODULE=on 2 3 # @commit should resolve 4 5 # golang.org/x/text/language@commit should not resolve with -m, 6 # because that's not a module path. 7 ! go get -m golang.org/x/text/language@14c0d48 8 9 # ... but it should work without -m. 10 # because of -d, the compiler should not run 11 go get -d -x golang.org/x/text/language@14c0d48 12 ! stderr 'compile|cp|gccgo .*language\.a$' 13 14 # go get should skip build with no Go files in root 15 go get golang.org/x/text@14c0d48 16 17 # ... and go get should skip build with -m 18 go get -m golang.org/x/text@14c0d48 19 20 # dropping -d, we should see a build. 21 go get -x golang.org/x/text/language@14c0d48 22 stderr 'compile|cp|gccgo .*language\.a$' 23 24 # BUG: after the build, the package should not be stale, as 'go install' would 25 # not do anything further. 26 go list -f '{{.Stale}}' golang.org/x/text/language 27 stdout ^true 28 29 # install after get should not run the compiler again. 30 go install -x golang.org/x/text/language 31 ! stderr 'compile|cp|gccgo .*language\.a$' 32 33 # even with -d, we should see an error for unknown packages. 34 ! go get -d -x golang.org/x/text/foo@14c0d48 35 36 # get pseudo-version should record that version 37 go get rsc.io/quote@v0.0.0-20180214005840-23179ee8a569 38 grep 'rsc.io/quote v0.0.0-20180214005840-23179ee8a569' go.mod 39 40 # but as commit should record as v1.5.1 41 go get rsc.io/quote@23179ee8 42 grep 'rsc.io/quote v1.5.1' go.mod 43 44 # go mod edit -require does not interpret commits 45 go mod edit -require rsc.io/quote@23179ee 46 grep 'rsc.io/quote 23179ee' go.mod 47 48 # but other commands fix them 49 go mod graph 50 grep 'rsc.io/quote v1.5.1' go.mod 51 52 -- go.mod -- 53 module x