-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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
proposal: testing: add TB.SetGOMAXPROCS #62020
Comments
Does this come up very often? You can also define a third party helper like func MaxProcs(t testing.TB, n int) {
prev := runtime.GOMAXPROCS(n)
t.Cleanup(func() { runtime.GOMAXPROCS(prev) })
}
// in a test
testhelpers.MaxProcs(t, 1) |
Change https://go.dev/cl/519235 mentions this issue: |
This comment was marked as resolved.
This comment was marked as resolved.
That CL should not have been committed. My mistake. Sent a revert. |
Change https://go.dev/cl/573516 mentions this issue: |
@earthboundkid @ianlancetaylor I thank you for working. I want to discuss whether this new API is necessary. |
This reverts CL 519235. Reason for revert: Proposal is still in incoming. For #62020 Change-Id: Icccb930209f36097f5d930c01eda6b5042bdddc1 Reviewed-on: https://go-review.googlesource.com/c/go/+/573516 Reviewed-by: Than McIntosh <thanm@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
I propose adding a SetGOMAXPROCS. This idea is inspired by TB.Setenv.
As seen Go source codes, too, if it sets GOMAXPROCS and it unsets this value after cleanup, we must write the following ways.
The writing style is general, if you know Go specification. But I think we can provide better way to achieve.
I submitted a CL. If this CL isn't been necessary, I don't mind to close it. Thanks.
The text was updated successfully, but these errors were encountered: