From 6687f3172f834090d2b3b098bec878df9a4b532f Mon Sep 17 00:00:00 2001 From: Solomon Jacobs Date: Sat, 23 May 2026 17:08:46 +0200 Subject: [PATCH] fix(env): Remove deprecated `auto-gomaxprocs` flag The `auto-gomaxprocs` flag was deprecated in v0.32. It has had no effect since v0.29, when we moved to Go 1.25, which natively handles container CPU quotas without the need for the automaxprocs library. See https://go.dev/blog/container-aware-gomaxprocs Signed-off-by: Solomon Jacobs --- cmd/alertmanager/main.go | 4 ---- featurecontrol/featurecontrol.go | 19 ------------------- 2 files changed, 23 deletions(-) diff --git a/cmd/alertmanager/main.go b/cmd/alertmanager/main.go index 4707cfb8ef..0e5142e8ac 100644 --- a/cmd/alertmanager/main.go +++ b/cmd/alertmanager/main.go @@ -224,10 +224,6 @@ func run() int { } } - if ff.EnableAutoGOMAXPROCS() { - logger.Warn("automaxprocs", "msg", "This flag is deprecated and will be removed in the next release") - } - err = os.MkdirAll(*dataDir, 0o777) if err != nil { logger.Error("Unable to create data directory", "err", err) diff --git a/featurecontrol/featurecontrol.go b/featurecontrol/featurecontrol.go index b162d783ac..3b5e65680d 100644 --- a/featurecontrol/featurecontrol.go +++ b/featurecontrol/featurecontrol.go @@ -27,7 +27,6 @@ const ( FeatureClassicMode = "classic-mode" FeatureUTF8StrictMode = "utf8-strict-mode" FeatureAutoGOMEMLIMIT = "auto-gomemlimit" - FeatureAutoGOMAXPROCS = "auto-gomaxprocs" FeatureEventRecorder = "event-recorder" ) @@ -38,7 +37,6 @@ var AllowedFlags = []string{ FeatureClassicMode, FeatureUTF8StrictMode, FeatureAutoGOMEMLIMIT, - FeatureAutoGOMAXPROCS, FeatureEventRecorder, } @@ -49,7 +47,6 @@ type Flagger interface { ClassicMode() bool UTF8StrictMode() bool EnableAutoGOMEMLIMIT() bool - EnableAutoGOMAXPROCS() bool EnableEventRecorder() bool } @@ -61,7 +58,6 @@ type Flags struct { classicMode bool utf8StrictMode bool enableAutoGOMEMLIMIT bool - enableAutoGOMAXPROCS bool enableEventRecorder bool } @@ -89,10 +85,6 @@ func (f *Flags) EnableAutoGOMEMLIMIT() bool { return f.enableAutoGOMEMLIMIT } -func (f *Flags) EnableAutoGOMAXPROCS() bool { - return f.enableAutoGOMAXPROCS -} - func (f *Flags) EnableEventRecorder() bool { return f.enableEventRecorder } @@ -129,12 +121,6 @@ func enableAutoGOMEMLIMIT() flagOption { } } -func enableAutoGOMAXPROCS() flagOption { - return func(configs *Flags) { - configs.enableAutoGOMAXPROCS = true - } -} - func enableEventRecorder() flagOption { return func(configs *Flags) { configs.enableEventRecorder = true @@ -175,9 +161,6 @@ func NewFlags(logger *slog.Logger, features string) (Flagger, error) { case FeatureAutoGOMEMLIMIT: opts = append(opts, enableAutoGOMEMLIMIT()) logger.Warn("Automatically set GOMEMLIMIT to match the Linux container or system memory limit.") - case FeatureAutoGOMAXPROCS: - opts = append(opts, enableAutoGOMAXPROCS()) - logger.Error("Deprecated: auto-gomaxprocs will be removed in v0.33. Removing this flag does not affect behavior, as Go 1.25+ natively handles container CPU quotas.") case FeatureEventRecorder: opts = append(opts, enableEventRecorder()) logger.Warn("Experimental event recorder enabled") @@ -211,6 +194,4 @@ func (n NoopFlags) UTF8StrictMode() bool { return false } func (n NoopFlags) EnableAutoGOMEMLIMIT() bool { return false } -func (n NoopFlags) EnableAutoGOMAXPROCS() bool { return false } - func (n NoopFlags) EnableEventRecorder() bool { return false }