Skip to content

Commit 4592933

Browse files
author
Bryan C. Mills
committed
cmd/go: document that tests must not write to their source modules
Fixes #28386 Updates #48495 Change-Id: I76186077c7bbe3f8f608026ee1865de83fe169b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/359574 Trust: Bryan C. Mills <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Go Bot <[email protected]>
1 parent 6afdf01 commit 4592933

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/cmd/go/alldocs.go

+5-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cmd/go/internal/test/test.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,11 @@ leave the test binary in pkg.test for use when analyzing the profiles.
407407
When 'go test' runs a test binary, it does so from within the
408408
corresponding package's source code directory. Depending on the test,
409409
it may be necessary to do the same when invoking a generated test
410-
binary directly.
410+
binary directly. Because that directory may be located within the
411+
module cache, which may be read-only and is verified by checksums, the
412+
test must not write to it or any other directory within the module
413+
unless explicitly requested by the user (such as with the -fuzz flag,
414+
which writes failures to testdata/fuzz).
411415
412416
The command-line package list, if present, must appear before any
413417
flag not known to the go test command. Continuing the example above,

0 commit comments

Comments
 (0)