Skip to content

feat: allow settings gomaxprocs in workflows#286

Draft
AtzeDeVries wants to merge 1 commit intomainfrom
update-go-app-workflow
Draft

feat: allow settings gomaxprocs in workflows#286
AtzeDeVries wants to merge 1 commit intomainfrom
update-go-app-workflow

Conversation

@AtzeDeVries
Copy link
Contributor

Signed-off-by: Atze de Vries atze.wiebe.de.vries@coop.no

Signed-off-by: Atze de Vries <atze.wiebe.de.vries@coop.no>
description: Run mage go related tasks in "docker" (default) or local
go-maxprocs:
type: number
default: 2
Copy link
Contributor

@alfredosa alfredosa Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AtzeDeVries maxprocs default is the maximum available cores or in 1.25 the cpu limits of the container:

https://go.dev/blog/container-aware-gomaxprocs

We want Go to provide efficient and reliable defaults when possible, so in Go 1.25, we have made GOMAXPROCS take into account its container environment by default. If a Go process is running inside a container with a CPU limit, GOMAXPROCS will default to the CPU limit if it is less than the core count.

Container orchestration systems may adjust container CPU limits on the fly, so Go 1.25 will also periodically check the CPU limit and adjust GOMAXPROCS automatically if it changes.

Both of these defaults only apply if GOMAXPROCS is otherwise unspecified. Setting the GOMAXPROCS environment variable or calling runtime.GOMAXPROCS continues to behave as before. The runtime.GOMAXPROCS documentation covers the details of the new behavior.

I think this might introduce a potential reduction in performance by defaulting to 2. Do we have to provide a default?

tho in ci/cd it might not be a big deal but in a test suite it might cause unexpected delays

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: “core” more precisely means “logical CPU.” (Also scavanged from the post for visibility)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants