Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: go.env modifications during bootstrap makes tests fail #61358

Closed
alexsaezm opened this issue Jul 14, 2023 · 6 comments
Closed

cmd/go: go.env modifications during bootstrap makes tests fail #61358

alexsaezm opened this issue Jul 14, 2023 · 6 comments
Assignees
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@alexsaezm
Copy link
Contributor

alexsaezm commented Jul 14, 2023

What version of Go are you using (go version)?

$ go version
go version go1.20.5 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOOS="linux"

What did you do?

Using go1.21rc3, modify the go.env file in the root folder to different values.

What did you expect to see?

No failure

What did you see instead?

vcs-test.golang.org rerouted to http://127.0.0.1:41523
https://vcs-test.golang.org rerouted to https://127.0.0.1:43845
go test proxy running at GOPROXY=http://127.0.0.1:42835/mod
--- FAIL: TestScript (0.15s)
    --- FAIL: TestScript/mod_sumdb_golang (0.04s)
        script_test.go:132: 2023-07-14T16:32:19Z
        script_test.go:134: $WORK=/tmp/cmd-go-test-3903922678/tmpdir168532271/mod_sumdb_golang759362308
        script_test.go:156:
            # Test default GOPROXY and GOSUMDB (0.040s)
            > env GOPROXY=
            > env GOSUMDB=
            > go env GOPROXY
            [stdout]
            direct
            > stdout '^https://proxy.golang.org,direct$'
        script_test.go:156: FAIL: testdata/script/mod_sumdb_golang.txt:5: stdout ^https://proxy.golang.org,direc
t$: no match for `(?m)^https://proxy.golang.org,direct$` in stdout
FAIL
FAIL    cmd/go  45.416s

This used to happend to in rc2 as far as I know: #57179 (comment)

@cherrymui cherrymui changed the title go.env modifications during bootstrap makes tests fail cmd/go: go.env modifications during bootstrap makes tests fail Jul 14, 2023
@cherrymui cherrymui added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels Jul 14, 2023
@cherrymui
Copy link
Member

Using go1.21rc3, modify the go.env file in the root folder to different values.

@alexsaezm could you clarify the exact commands you run? Modify the go.env file, then run all.bash?
And does this reproduce with Go 1.20? Thanks.

Perhaps setting GOPROXY and GOSUMDB to empty just makes them to use the value in the go.env file. The test probably needs some mechanism to ignore go.env file.

cc @bcmills @matloob

@cherrymui cherrymui added this to the Backlog milestone Jul 14, 2023
@cherrymui cherrymui added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jul 14, 2023
@bcmills
Copy link
Contributor

bcmills commented Jul 14, 2023

Using go1.21rc3, modify the go.env file in the root folder to different values.

Which values specifically?

@gopherbot
Copy link

Change https://go.dev/cl/509637 mentions this issue: cmd/go: fix tests with GOPROXY=direct in go.env

@alexsaezm
Copy link
Contributor Author

I modified the go.env file in the root of the project like this:

$ cat go.env
# This file contains the initial defaults for go command configuration.
# Values set by 'go env -w' and written to the user's go/env file override these.
# The environment overrides everything else.

# Use the Go module mirror and checksum database by default.
# See https://proxy.golang.org for details.
GOPROXY=direct
GOSUMDB=off

# Automatically download newer toolchains as directed by go.mod files.
# See https://go.dev/doc/toolchain for details.
GOTOOLCHAIN=auto

And then, I ran ./all.bash.

To clarify, this doesn't happen in 1.20 because there is no go.env file.

@cherrymui cherrymui removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jul 17, 2023
@bcmills
Copy link
Contributor

bcmills commented Jul 17, 2023

@alexsaezm, https://go.dev/cl/509637 should fix this at HEAD; can you please build at commit 229cde5 or later and confirm?

@bcmills bcmills modified the milestones: Backlog, Go1.21 Jul 17, 2023
@bcmills bcmills self-assigned this Jul 17, 2023
@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jul 17, 2023
@alexsaezm
Copy link
Contributor Author

@alexsaezm, https://go.dev/cl/509637 should fix this at HEAD; can you please build at commit 229cde5 or later and confirm?

It works. Thank you!

Regarding the commit message about the builders: just for the record, Fedora's Go package is built with the go.env modified so in case of any error, I'll report it. (Not a substitute of a builder by any means, because it's not integrated at all with Go upstream systems and includes other patches but, just to let you know)

bradfitz pushed a commit to tailscale/go that referenced this issue Aug 2, 2023
Tested locally by changing GOROOT/go.env. At some point perhaps we
should also set up a builder that runs with some common expected
modifications to go.env
(such as GOTOOLCHAIN=local GOPROXY=direct GOSUMDB=off).

Fixes golang#61358.
Updates golang#61359.

Change-Id: I365ec536bec86370e302fb726fa897400ab42cf3
Reviewed-on: https://go-review.googlesource.com/c/go/+/509637
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants