Skip to content

cmd/go: TestNewReleaseRebuildsStalePackagesInGOPATH modifies code in GOROOT #29263

Closed
@bcmills

Description

@bcmills

go test cmd/go should succeed even if the user cannot write to GOROOT, as may be the case if the Go toolchain is provided by a system distribution. (See also #28387.)

Unfortunately, today TestNewReleaseRebuildsStalePackagesInGOPATH assumes that it can write to GOROOT/src:

sys := runtime.GOROOT() + "/src/runtime/internal/sys/sys.go"

That not only risks a failed write to an unwritable directory, but also makes go test cmd/go dangerous to run concurrently with any build information, and potentially introduces spurious diffs during testing in development copies of the go repository.

Activity

added
TestingAn issue that has been verified to require only test changes, not just a test failure.
on Dec 14, 2018
added this to the Go1.13 milestone on Dec 14, 2018
added
NeedsFixThe path to resolution is known, but the work has not been done.
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
on Dec 14, 2018
removed
NeedsFixThe path to resolution is known, but the work has not been done.
on Dec 14, 2018
bcmills

bcmills commented on Dec 14, 2018

@bcmills
ContributorAuthor

One possible resolution might be to copy relevant parts of GOROOT into a temporary directory.

bcmills

bcmills commented on Dec 14, 2018

@bcmills
ContributorAuthor
ianlancetaylor

ianlancetaylor commented on Dec 17, 2018

@ianlancetaylor
Contributor

I sent a fix for that test but there are probably others.

gopherbot

gopherbot commented on Dec 17, 2018

@gopherbot
Contributor

Change https://golang.org/cl/154460 mentions this issue: cmd/go: don't modify GOROOT in TestNewReleaseRebuildsStalePackagesInGOPATH

locked and limited conversation to collaborators on Jan 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeGoCommandcmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.TestingAn issue that has been verified to require only test changes, not just a test failure.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ianlancetaylor@bcmills@gopherbot

        Issue actions

          cmd/go: TestNewReleaseRebuildsStalePackagesInGOPATH modifies code in GOROOT · Issue #29263 · golang/go