Skip to content
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

fix: panic when concurrency=0 #4477

Merged
merged 1 commit into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .golangci.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

# Options for analysis running.
run:
# Number of CPUs to use when running golangci-lint.
# Number of operating system threads (`GOMAXPROCS`) that can execute golangci-lint simultaneously.
ldez marked this conversation as resolved.
Show resolved Hide resolved
# 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
concurrency: 4

Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (c *runCommand) persistentPreRunE(cmd *cobra.Command, _ []string) error {

if c.cfg.Run.Concurrency == 0 {
// Automatically set GOMAXPROCS to match Linux container CPU quota.
_, _ = maxprocs.Set(nil)
_, _ = maxprocs.Set(maxprocs.Logger(c.log.Infof))
ldez marked this conversation as resolved.
Show resolved Hide resolved
} else {
runtime.GOMAXPROCS(c.cfg.Run.Concurrency)
}
Expand Down
Loading