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