1 # This test ensures .netrc and _netrc are both supported on windows.
2 # See golang.org/issue/66832
3
4 [!GOOS:windows] skip
5 [short] skip
6
7 env GOPROXY=direct
8 env GOSUMDB=off
9 mkdir $WORK\home
10 env USERPROFILE=$WORK\home
11
12 # Make sure _netrc works.
13 cp netrc_file $WORK\home\_netrc
14 cp go.mod.orig go.mod
15 go mod tidy
16 go list all
17 stdout vcs-test.golang.org/auth/or401
18 stdout vcs-test.golang.org/auth/or404
19 rm $WORK\home\_netrc
20
21 # Without credentials, downloading a module from a path that requires HTTPS
22 # basic auth should fail.
23 cp go.mod.orig go.mod
24 ! go mod tidy
25 stderr '^\tserver response: ACCESS DENIED, buddy$'
26 stderr '^\tserver response: File\? What file\?$'
27
28 # Make sure .netrc works as a fallback.
29 cp netrc_file $WORK\home\.netrc
30 cp go.mod.orig go.mod
31 go mod tidy
32 go list all
33 stdout vcs-test.golang.org/auth/or401
34 stdout vcs-test.golang.org/auth/or404
35
36 -- go.mod.orig --
37 module private.example.com
38 -- main.go --
39 package useprivate
40
41 import (
42 _ "vcs-test.golang.org/auth/or401"
43 _ "vcs-test.golang.org/auth/or404"
44 )
45 -- netrc_file --
46 machine vcs-test.golang.org
47 login aladdin
48 password opensesame
49
View as plain text