Skip to content

Commit 0a0f8ba

Browse files
committed
cmd/go: document that -p applies to test binary execution
Fixes #11521. Change-Id: I73615b881df4a0d5e2f5bc5059359d150ca8c105 Reviewed-on: https://go-review.googlesource.com/17946 Reviewed-by: Joe Shaw <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 7688f0d commit 0a0f8ba

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/cmd/go/alldocs.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ and test commands:
8484
-n
8585
print the commands but do not run them.
8686
-p n
87-
the number of builds that can be run in parallel.
87+
the number of programs, such as build commands or
88+
test binaries, that can be run in parallel.
8889
The default is the number of CPUs available, except
8990
on darwin/arm which defaults to 1.
9091
-race
@@ -1420,6 +1421,10 @@ control the execution of any test:
14201421
Allow parallel execution of test functions that call t.Parallel.
14211422
The value of this flag is the maximum number of tests to run
14221423
simultaneously; by default, it is set to the value of GOMAXPROCS.
1424+
Note that -parallel only applies within a single test binary.
1425+
The 'go test' command may run tests for different packages
1426+
in parallel as well, according to the setting of the -p flag
1427+
(see 'go help build').
14231428
14241429
-run regexp
14251430
Run only those tests and examples matching the regular

src/cmd/go/build.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ and test commands:
6363
-n
6464
print the commands but do not run them.
6565
-p n
66-
the number of builds that can be run in parallel.
66+
the number of programs, such as build commands or
67+
test binaries, that can be run in parallel.
6768
The default is the number of CPUs available, except
6869
on darwin/arm which defaults to 1.
6970
-race

src/cmd/go/test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ const testFlag2 = `
207207
Allow parallel execution of test functions that call t.Parallel.
208208
The value of this flag is the maximum number of tests to run
209209
simultaneously; by default, it is set to the value of GOMAXPROCS.
210+
Note that -parallel only applies within a single test binary.
211+
The 'go test' command may run tests for different packages
212+
in parallel as well, according to the setting of the -p flag
213+
(see 'go help build').
210214
211215
-run regexp
212216
Run only those tests and examples matching the regular

0 commit comments

Comments
 (0)