fix: panic when concurrency=0 (#4477)

This commit is contained in:
Ludovic Fernandez 2024-03-10 15:43:09 +01:00 committed by GitHub
parent 797d3bb0c4
commit c902b8e9d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -6,7 +6,8 @@
# Options for analysis running. # Options for analysis running.
run: run:
# Number of CPUs to use when running golangci-lint. # Number of operating system threads (`GOMAXPROCS`) that can execute golangci-lint simultaneously.
# 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.
# Default: the number of logical CPUs in the machine # Default: the number of logical CPUs in the machine
concurrency: 4 concurrency: 4

View File

@ -157,7 +157,7 @@ func (c *runCommand) persistentPreRunE(cmd *cobra.Command, _ []string) error {
if c.cfg.Run.Concurrency == 0 { if c.cfg.Run.Concurrency == 0 {
// Automatically set GOMAXPROCS to match Linux container CPU quota. // Automatically set GOMAXPROCS to match Linux container CPU quota.
_, _ = maxprocs.Set(nil) _, _ = maxprocs.Set(maxprocs.Logger(c.log.Infof))
} else { } else {
runtime.GOMAXPROCS(c.cfg.Run.Concurrency) runtime.GOMAXPROCS(c.cfg.Run.Concurrency)
} }