Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitff210a0

Browse files
committed
main: respect GOMAXPROCS environment variable
If the user sets GOMAXPROCS explicitely, we shouldrespect it.
1 parentd5ce340 commitff210a0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎main.go‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,9 @@ func printVersion() {
133133

134134
funcmain() {
135135
mxp:=runtime.GOMAXPROCS(0)
136-
ifmxp<4 {
137-
// On a 2-core machine, setting maxprocs to 4 gives 10% better performance
136+
ifmxp<4&&os.Getenv("GOMAXPROCS")=="" {
137+
// On a 2-core machine, setting maxprocs to 4 gives 10% better performance.
138+
// But don't override an explicitely set GOMAXPROCS env variable.
138139
runtime.GOMAXPROCS(4)
139140
}
140141
// mount(1) unsets PATH. Since exec.Command does not handle this case, we set

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp