ex icon indicating copy to clipboard operation
ex copied to clipboard

Disable automaxprocs on Go 1.25+

Open DomParfitt opened this issue 4 months ago • 2 comments

Cribbed from: https://github.com/circleci/backplane-go/pull/549

DomParfitt avatar Aug 21 '25 09:08 DomParfitt

Sorry, for my own understanding, could you explain why we're doing this? 🤔

notthepoint avatar Aug 21 '25 12:08 notthepoint

Sorry, for my own understanding, could you explain why we're doing this? 🤔

Yep. Go has a setting called GOMAXPROCS, which is used to set the number of CPU cores available to the Go runtime and has some default behaviour to detect the CPU count when it's not explicitly specified. Unfortunately that CPU detect was not container aware (until recently) so the auto detection didn't work properly when running a Go binary in a container. Because of that we (and pretty much everyone else using Go in production) use a package called automaxprocs, which correctly sets GOMAXPROCS when running in a container. As of Go 1.25 the CPU detection in Go is now container aware, so that package is no longer needed.

DomParfitt avatar Aug 21 '25 12:08 DomParfitt