mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/go: do not call base.fatal for an unset HOME for GOAUTH=netrc
This CL silences errors caused by GOAUTH=netrc and HOME being unset. Instead, we log the error if the -x flag is set. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest Change-Id: Ibd323769f3562c169ebf559e060e9afbb63047bc Reviewed-on: https://go-review.googlesource.com/c/go/+/643917 Reviewed-by: Michael Matloob <matloob@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
475e08349d
commit
f70aa3824b
2 changed files with 15 additions and 1 deletions
|
|
@ -70,7 +70,8 @@ func runGoAuth(client *http.Client, res *http.Response, url string) {
|
||||||
case "netrc":
|
case "netrc":
|
||||||
lines, err := readNetrc()
|
lines, err := readNetrc()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
base.Fatalf("go: could not parse netrc (GOAUTH=%s): %v", cfg.GOAUTH, err)
|
cmdErrs = append(cmdErrs, fmt.Errorf("GOAUTH=%s: %v", command, err))
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
// Process lines in reverse so that if the same machine is listed
|
// Process lines in reverse so that if the same machine is listed
|
||||||
// multiple times, we end up saving the earlier one
|
// multiple times, we end up saving the earlier one
|
||||||
|
|
|
||||||
13
src/cmd/go/testdata/script/goauth_netrc.txt
vendored
13
src/cmd/go/testdata/script/goauth_netrc.txt
vendored
|
|
@ -53,6 +53,19 @@ go get vcs-test.golang.org/auth/or401
|
||||||
env NETRC=$WORK/missing
|
env NETRC=$WORK/missing
|
||||||
! go get vcs-test.golang.org/auth/or401
|
! go get vcs-test.golang.org/auth/or401
|
||||||
stderr '^\tserver response: ACCESS DENIED, buddy$'
|
stderr '^\tserver response: ACCESS DENIED, buddy$'
|
||||||
|
|
||||||
|
[short] skip 'requires a remote vcs lookup'
|
||||||
|
[!git] skip
|
||||||
|
# An unset home directory should warn the user but not cause a failure.
|
||||||
|
env NETRC=
|
||||||
|
env HOME=
|
||||||
|
env USERPROFILE=
|
||||||
|
env home=
|
||||||
|
go get -x vcs-test.golang.org/git/emptytest.git
|
||||||
|
[!GOOS:windows] [!GOOS:plan9] stderr 'GOAUTH=netrc: \$HOME is not defined'
|
||||||
|
[GOOS:windows] stderr 'GOAUTH=netrc: \%userprofile\% is not defined'
|
||||||
|
[GOOS:plan9] stderr 'GOAUTH=netrc: \$home is not defined'
|
||||||
|
|
||||||
-- go.mod --
|
-- go.mod --
|
||||||
module private.example.com
|
module private.example.com
|
||||||
-- $WORK/empty --
|
-- $WORK/empty --
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue