...

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

Documentation: cmd/go/testdata/script

     1env GO111MODULE=on
     2
     3# Testing stderr for git ls-remote; turn off proxy.
     4[!net:github.com] skip
     5[!git] skip
     6env GOPROXY=direct
     7
     8# Redirect git to a test-specific .gitconfig.
     9# GIT_CONFIG_GLOBAL suffices for git 2.32.0 and newer.
    10# For older git versions we also set $HOME.
    11env GIT_CONFIG_GLOBAL=$WORK${/}home${/}gopher${/}.gitconfig
    12env HOME=$WORK${/}home${/}gopher
    13exec git config --global --show-origin user.name
    14stdout 'Go Gopher'
    15
    16! go mod download github.com/golang/nonexist@latest
    17stderr 'Confirm the import path was entered correctly.'
    18stderr 'If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.'
    19! stdout .
    20
    21# Fetching a nonexistent commit should return an "unknown revision"
    22# error message.
    23! go mod download github.com/golang/term@86186f3aba07ed0212cfb944f3398997d2d07c6b
    24stderr '^go: github.com/golang/term@86186f3aba07ed0212cfb944f3398997d2d07c6b: invalid version: unknown revision 86186f3aba07ed0212cfb944f3398997d2d07c6b$'
    25! stdout .
    26
    27! go mod download github.com/golang/nonexist@master
    28stderr '^Confirm the import path was entered correctly.$'
    29stderr '^If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.$'
    30! stderr 'unknown revision'
    31! stdout .
    32
    33[!exec:false] stop
    34
    35# Test that Git clone errors will be shown to the user instead of a generic
    36# "unknown revision" error. To do this we want to force git ls-remote to return
    37# an error we don't already have special handling for. See golang/go#42751.
    38exec git config --global url.git@github.com.insteadOf https://github.com/
    39env GIT_SSH_COMMAND=false
    40! go install github.com/golang/nonexist@master
    41stderr 'fatal: Could not read from remote repository.'
    42! stderr 'unknown revision'
    43! stdout .
    44
    45-- $WORK/home/gopher/.gitconfig --
    46[user]
    47	name = Go Gopher
    48	email = gopher@golang.org

View as plain text