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: non-script staleness checks interact badly with GOFLAGS #43012

Closed
bcmills opened this issue Dec 4, 2020 · 1 comment
Closed

cmd/go: non-script staleness checks interact badly with GOFLAGS #43012

bcmills opened this issue Dec 4, 2020 · 1 comment
Labels
FrozenDueToAge GoCommand cmd/go help wanted NeedsFix The path to resolution is known, but the work has not been done. Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Dec 4, 2020

I think the non-script cmd/go tests are missing a step to zero out GOFLAGS from the user's environment.

The fix is probably to unset GOFLAGS in this block:

go/src/cmd/go/go_test.go

Lines 217 to 218 in 05ddb87

// Don't let these environment variables confuse the test.
os.Setenv("GOENV", "off")

~/go-review/src$ ./make.bash
Building Go cmd/dist using /usr/local/google/home/bcmills/go1.4. (go1.4-bootstrap-20170531 linux/amd64)
Building Go toolchain1 using /usr/local/google/home/bcmills/go1.4.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.
---
Installed Go for linux/amd64 in /usr/local/google/home/bcmills/go-review
Installed commands in /usr/local/google/home/bcmills/go-review/bin

~/go-review/src$ go version
go version devel +edf60be151 Fri Dec 4 18:03:43 2020 +0000 linux/amd64

~/go-review/src$ export GOFLAGS='-gcflags=-e'

~/go-review/src$ go test cmd/go/...
go test proxy running at GOPROXY=http://127.0.0.1:34961/mod
--- FAIL: TestCacheListStale (0.29s)
    go_test.go:2271: running testgo [install p m]
    go_test.go:2272: running testgo [list -f={{.ImportPath}} {{.Stale}} m q p]
    go_test.go:2272: standard output:
    go_test.go:2272: m true
        q true
        p true

    go_test.go:2273: m should not be stale
    go_test.go:2273: pattern ^m false not found in standard output
--- FAIL: TestInstallDeps (0.33s)
    go_test.go:2528: running testgo [list -f={{.Target}} p1]
    go_test.go:2528: standard output:
    go_test.go:2528: /tmp/cmd-go-test-995578665/gotest858697184/pkg/linux_amd64/p1.a

    go_test.go:2530: running testgo [list -f={{.Target}} p2]
    go_test.go:2530: standard output:
    go_test.go:2530: /tmp/cmd-go-test-995578665/gotest858697184/pkg/linux_amd64/p2.a

    go_test.go:2532: running testgo [list -f={{.Target}} main1]
    go_test.go:2532: standard output:
    go_test.go:2532: /tmp/cmd-go-test-995578665/gotest858697184/bin/main1

    go_test.go:2535: running testgo [install main1]
    go_test.go:2541: running testgo [install p2]
    go_test.go:2546: running testgo [list -f {{.Stale}}:{{.StaleReason}} runtime]
    go_test.go:2546: standard output:
    go_test.go:2546: true:build ID mismatch

    go_test.go:2546: must be non-stale before install -i
--- FAIL: TestIssue22588 (0.12s)
    go_test.go:2306: running testgo [list -f={{.Stale}} runtime]
    go_test.go:2306: standard output:
    go_test.go:2306: true

    go_test.go:2307: running testgo [list -toolexec=/usr/bin/time -f={{.Stale}} runtime]
    go_test.go:2307: standard output:
    go_test.go:2307: true

    go_test.go:2308: incorrectly reported runtime as stale
    go_test.go:2308: pattern false not found in standard output
--- FAIL: TestGoTestDashIDashOWritesBinary (0.06s)
    go_test.go:1400: running testgo [list -f {{.Stale}}:{{.StaleReason}} runtime]
    go_test.go:1400: standard output:
    go_test.go:1400: true:build ID mismatch

    go_test.go:1400: must be non-stale before test -i
FAIL
FAIL    cmd/go  191.829s

CC @matloob @jayconrod

@bcmills bcmills added Testing An issue that has been verified to require only test changes, not just a test failure. help wanted NeedsFix The path to resolution is known, but the work has not been done. GoCommand cmd/go labels Dec 4, 2020
@bcmills bcmills added this to the Backlog milestone Dec 4, 2020
@gopherbot
Copy link

Change https://golang.org/cl/277453 mentions this issue: cmd/go: fix non-script staleness checks interacting badly with GOFLAGS

@golang golang locked and limited conversation to collaborators Jan 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go help wanted NeedsFix The path to resolution is known, but the work has not been done. Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@bcmills @gopherbot and others