1 env GO111MODULE=on
2
3 # Testing stderr for git ls-remote; turn off proxy.
4 [!net] skip
5 [!exec:git] skip
6 env GOPROXY=direct
7
8 ! go mod download github.com/golang/nonexist@latest
9 stderr 'Confirm the import path was entered correctly.'
10 stderr 'If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.'
11 ! stdout .
12
13 # Fetching a nonexistent commit should return an "unknown revision"
14 # error message.
15 ! go mod download github.com/golang/term@86186f3aba07ed0212cfb944f3398997d2d07c6b
16 stderr '^go: github.com/golang/term@86186f3aba07ed0212cfb944f3398997d2d07c6b: invalid version: unknown revision 86186f3aba07ed0212cfb944f3398997d2d07c6b$'
17 ! stdout .
18
19 ! go mod download github.com/golang/nonexist@master
20 stderr '^Confirm the import path was entered correctly.$'
21 stderr '^If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.$'
22 ! stderr 'unknown revision'
23 ! stdout .
24
25 [!linux] stop # Needs XDG_CONFIG_HOME.
26 [!exec:false] stop
27
28 # Test that Git clone errors will be shown to the user instead of a generic
29 # "unknown revision" error. To do this we want to force git ls-remote to return
30 # an error we don't already have special handling for. See golang/go#42751.
31 #
32 # Set XDG_CONFIG_HOME to tell Git where to look for the git config file listed
33 # below, which turns on ssh.
34 env XDG_CONFIG_HOME=$TMPDIR
35 env GIT_SSH_COMMAND=false
36 ! go install github.com/golang/nonexist@master
37 stderr 'fatal: Could not read from remote repository.'
38 ! stderr 'unknown revision'
39 ! stdout .
40
41 -- $TMPDIR/git/config --
42 [url "git@github.com:"]
43 insteadOf = https://github.com/
44
View as plain text