Black Lives Matter. Support the Equal Justice Initiative.

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

Documentation: cmd/go/testdata/script

     1  env 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.
     8  go get -d -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
    12  go get -d golang.org/x/text@14c0d48
    13  
    14  # dropping -d, we should see a build.
    15  [short] skip
    16  
    17  env GOCACHE=$WORK/gocache  # Looking for compile commands, so need a clean cache.
    18  
    19  go get -x golang.org/x/text/language@14c0d48
    20  stderr 'compile|cp|gccgo .*language\.a$'
    21  
    22  # BUG: after the build, the package should not be stale, as 'go install' would
    23  # not do anything further.
    24  go list -f '{{.Stale}}' golang.org/x/text/language
    25  stdout ^true
    26  
    27  # install after get should not run the compiler again.
    28  go install -x golang.org/x/text/language
    29  ! stderr 'compile|cp|gccgo .*language\.a$'
    30  
    31  # even with -d, we should see an error for unknown packages.
    32  ! go get -d -x golang.org/x/text/foo@14c0d48
    33  
    34  # get pseudo-version should record that version
    35  go get -d rsc.io/quote@v0.0.0-20180214005840-23179ee8a569
    36  grep 'rsc.io/quote v0.0.0-20180214005840-23179ee8a569' go.mod
    37  
    38  # but as commit should record as v1.5.1
    39  go get -d rsc.io/quote@23179ee8
    40  grep 'rsc.io/quote v1.5.1' go.mod
    41  
    42  # go mod edit -require does not interpret commits
    43  go mod edit -require rsc.io/quote@23179ee
    44  grep 'rsc.io/quote 23179ee' go.mod
    45  
    46  # but other commands fix them
    47  go mod graph
    48  grep 'rsc.io/quote v1.5.1' go.mod
    49  
    50  -- go.mod --
    51  module x
    52  

View as plain text