Skip to content

Commit c902b8e

Browse files
authored
fix: panic when concurrency=0 (#4477)
1 parent 797d3bb commit c902b8e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

.golangci.reference.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
# Options for analysis running.
88
run:
9-
# Number of CPUs to use when running golangci-lint.
9+
# Number of operating system threads (`GOMAXPROCS`) that can execute golangci-lint simultaneously.
10+
# If it is explicitly set to 0 (i.e. not the default) then golangci-lint will automatically set the value to match Linux container CPU quota.
1011
# Default: the number of logical CPUs in the machine
1112
concurrency: 4
1213

pkg/commands/run.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func (c *runCommand) persistentPreRunE(cmd *cobra.Command, _ []string) error {
157157

158158
if c.cfg.Run.Concurrency == 0 {
159159
// Automatically set GOMAXPROCS to match Linux container CPU quota.
160-
_, _ = maxprocs.Set(nil)
160+
_, _ = maxprocs.Set(maxprocs.Logger(c.log.Infof))
161161
} else {
162162
runtime.GOMAXPROCS(c.cfg.Run.Concurrency)
163163
}

0 commit comments

Comments
 (0)