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: document that tests should not write to their working directory #28386

Closed
bcmills opened this issue Oct 25, 2018 · 3 comments
Closed
Labels
Documentation FrozenDueToAge GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Oct 25, 2018

The contents of modules are shared and immutable (#27161), and it is important that the contents of a module remain consistent. Similarly, the contents of the standard library are not writable in many distributions of the Go toolchain.

Tests are defined to run within the directory containing their source code, so the above implies that tests must not assume that they can write to the current directory. We should make sure that is clearly documented.

@bcmills bcmills added Documentation NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Oct 25, 2018
@bcmills bcmills added this to the Go1.12 milestone Oct 25, 2018
@gopherbot
Copy link

Change https://golang.org/cl/152817 mentions this issue: cmd/cover: run tests in parallel, don't change source directory

gopherbot pushed a commit that referenced this issue Dec 6, 2018
This speeds up the cmd/cover testsuite by about 40% on my laptop.

Updates #26473
Updates #28386

Change-Id: I853b1b3b8c98dc89440f7b7bf5c0ade1d3d66802
Reviewed-on: https://go-review.googlesource.com/c/152817
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@andybons andybons modified the milestones: Go1.12, Go1.13 Feb 12, 2019
@andybons andybons modified the milestones: Go1.13, Go1.14 Jul 8, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
@bcmills bcmills self-assigned this Oct 29, 2021
@bcmills bcmills modified the milestones: Backlog, Go1.18 Oct 29, 2021
@gopherbot
Copy link

Change https://golang.org/cl/359574 mentions this issue: testing: document that tests must not write to source directories

@bcmills bcmills added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 29, 2021
@gopherbot gopherbot removed the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 29, 2021
@bcmills
Copy link
Contributor Author

bcmills commented Oct 29, 2021

The testing package itself does not actually document where the test will be run; that information is found in go help test, so that is where this clarification will go as well.

@bcmills bcmills changed the title testing: document that tests should not write to their working directory cmd/go: document that tests should not write to their working directory Oct 29, 2021
@rsc rsc unassigned bcmills Jun 23, 2022
@golang golang locked and limited conversation to collaborators Jun 23, 2023
@dmitshur dmitshur added the GoCommand cmd/go label Sep 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge 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