mirror of https://github.com/golang/go.git
cmd/go: initialize req.Header when loading git credential
Fixes #71604 Change-Id: I3d733a50b4451dfb571aba91a28387ba9e0614dc Reviewed-on: https://go-review.googlesource.com/c/go/+/647615 Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Sam Thanawalla <samthanawalla@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
parent
b574590c36
commit
58834c3ee0
|
|
@ -128,7 +128,8 @@ func runGoAuth(client *http.Client, res *http.Response, url string) {
|
|||
// If no GOAUTH command provided a credential for the given url
|
||||
// and an error occurred, log the error.
|
||||
if cfg.BuildX && url != "" {
|
||||
if ok := loadCredential(&http.Request{}, url); !ok && len(cmdErrs) > 0 {
|
||||
req := &http.Request{Header: make(http.Header)}
|
||||
if ok := loadCredential(req, url); !ok && len(cmdErrs) > 0 {
|
||||
log.Printf("GOAUTH encountered errors for %s:", url)
|
||||
for _, err := range cmdErrs {
|
||||
log.Printf(" %v", err)
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ go get vcs-test.golang.org/auth/or401
|
|||
go mod tidy
|
||||
go list all
|
||||
stdout vcs-test.golang.org/auth/or404
|
||||
# With cached credentials, re-downloading in debug mode should succeed.
|
||||
go get -x vcs-test.golang.org/auth/or401
|
||||
|
||||
# Clearing GOAUTH credentials should result in failures.
|
||||
env GOAUTH='off'
|
||||
|
|
|
|||
Loading…
Reference in New Issue