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

     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 -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 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 build -x golang.org/x/text/language
    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 build should not run the compiler again.
    28  go install -x golang.org/x/text/language
    29  ! stderr 'compile|cp|gccgo .*language\.a$'
    30  
    31  # we should see an error for unknown packages.
    32  ! go get -x golang.org/x/text/foo@14c0d48
    33  stderr '^go: module golang.org/x/text@14c0d48 found \(v0.3.0\), but does not contain package golang.org/x/text/foo$'
    34  
    35  # get pseudo-version should record that version
    36  go get rsc.io/quote@v0.0.0-20180214005840-23179ee8a569
    37  grep 'rsc.io/quote v0.0.0-20180214005840-23179ee8a569' go.mod
    38  
    39  # but as commit should record as v1.5.1
    40  go get rsc.io/quote@23179ee8
    41  grep 'rsc.io/quote v1.5.1' go.mod
    42  
    43  # go mod edit -require does not interpret commits
    44  go mod edit -require rsc.io/quote@23179ee
    45  grep 'rsc.io/quote 23179ee' go.mod
    46  
    47  # but other commands fix them
    48  go list -m -mod=mod all
    49  grep 'rsc.io/quote v1.5.1' go.mod
    50  
    51  -- go.mod --
    52  module x
    53  

View as plain text