...

Text file src/cmd/go/testdata/script/mod_get_commit.txt

Documentation: cmd/go/testdata/script

     1env GO111MODULE=on
     2[short] skip
     3
     4# @commit should resolve
     5
     6# golang.org/x/text/language@commit should resolve.
     7# Because of -d, the compiler should not run.
     8go get -x golang.org/x/text/language@14c0d48
     9! stderr 'compile|cp|gccgo .*language\.a$'
    10
    11# go get should skip build with no Go files in root
    12go get golang.org/x/text@14c0d48
    13
    14# dropping -d, we should see a build.
    15[short] skip
    16
    17env GOCACHE=$WORK/gocache  # Looking for compile commands, so need a clean cache.
    18
    19go build -x golang.org/x/text/language
    20stderr 'compile|cp|gccgo .*language\.a$'
    21
    22go list -f '{{.Stale}}' golang.org/x/text/language
    23stdout ^false
    24
    25# install after build should not run the compiler again.
    26go install -x golang.org/x/text/language
    27! stderr 'compile|cp|gccgo .*language\.a$'
    28
    29# we should see an error for unknown packages.
    30! go get -x golang.org/x/text/foo@14c0d48
    31stderr '^go: module golang.org/x/text@14c0d48 found \(v0.3.0\), but does not contain package golang.org/x/text/foo$'
    32
    33# get pseudo-version should record that version
    34go get rsc.io/quote@v0.0.0-20180214005840-23179ee8a569
    35grep 'rsc.io/quote v0.0.0-20180214005840-23179ee8a569' go.mod
    36
    37# but as commit should record as v1.5.1
    38go get rsc.io/quote@23179ee8
    39grep 'rsc.io/quote v1.5.1' go.mod
    40
    41# go mod edit -require does not interpret commits
    42go mod edit -require rsc.io/quote@23179ee
    43grep 'rsc.io/quote 23179ee' go.mod
    44
    45# but other commands fix them
    46go list -m -mod=mod all
    47grep 'rsc.io/quote v1.5.1' go.mod
    48
    49-- go.mod --
    50module x

View as plain text