Skip to content

Commit 1908e94

Browse files
TheMeierSoloJacobs
andauthored
chore: udate minimum Go version to 1.26 (#5461)
Bumps `.github/workflows`, `promu` and UI build container to 1.27. We generally keep the minimum required version (1.26) and these versions exactly one minor version apart. Fixes done via `golanglint-ci run --fix`. Also bumps GOLANGCI_LINT_VERSION. This version is required, since the previous was not compatible with Go 1.27. Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com> Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com> Co-authored-by: Solomon Jacobs <solomonjacobs@protonmail.com>
1 parent 67dda30 commit 1908e94

24 files changed

Lines changed: 84 additions & 121 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
# should also be updated.
6464
container:
6565

66-
image: quay.io/prometheus/golang-builder:1.26-base
66+
image: quay.io/prometheus/golang-builder:1.27-base
6767
services:
6868
maildev-noauth:
6969
image: maildev/maildev:2.2.1

.github/workflows/mixin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: install Go
2020
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
2121
with:
22-
go-version: 1.26.x
22+
go-version: 1.27.x
2323
# pin the mixtool version until https://github.com/monitoring-mixins/mixtool/issues/135 is merged.
2424
- run: go install github.com/monitoring-mixins/mixtool/cmd/mixtool@2282201396b69055bb0f92f187049027a16d2130
2525
- run: go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest

.golangci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ formatters:
9696
- goimports
9797
settings:
9898
gofumpt:
99-
extra-rules: true
99+
extra:
100+
group-params: true
100101
goimports:
101102
local-prefixes:
102103
- github.com/prometheus/alertmanager

.promu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
go:
22
# Whenever the Go version is updated here,
33
# .github/workflows/ci.yml and ui/app/Makefile should also be updated.
4-
version: 1.26
4+
version: 1.27
55
repository:
66
path: github.com/prometheus/alertmanager
77
build:

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Guidance for AI coding agents working in this repository. Keep this file concise
66

77
Alertmanager handles alerts sent by clients such as Prometheus. It deduplicates, groups, routes, silences, and inhibits alerts, and dispatches them to receiver integrations (email, PagerDuty, Slack, webhook, etc.).
88

9-
- Language: Go (see `go.mod` for the required version, currently `go 1.25`).
9+
- Language: Go (see `go.mod` for the required version, currently `go 1.26`).
1010
- Frontend (legacy): Elm app under `ui/app/` (Node version pinned in `.nvmrc`).
1111
- Frontend (new): React + TypeScript + Mantine under `ui/mantine-ui/`.
1212
- API: OpenAPI v2 spec in `api/v2/openapi.yaml`; Go server/client/models are generated via `scripts/swagger.sh`.

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
# Needs to be defined before including Makefile.common to auto-generate targets
1515
DOCKER_ARCHS ?= amd64 armv7 arm64 ppc64le s390x
1616

17+
GOLANGCI_LINT_VERSION := v2.13.1
18+
1719
include Makefile.common
1820

1921
FRONTEND_DIR = $(BIN_DIR)/ui/app

api/v2/api_test.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,6 @@ func TestGetSilencesHandler(t *testing.T) {
160160
}
161161
}
162162

163-
func boolPtr(b bool) *bool { return &b }
164-
165163
func TestGetSilencesHandlerStateFilter(t *testing.T) {
166164
now := timestamppb.Now()
167165
silences := newSilences(t)
@@ -228,23 +226,23 @@ func TestGetSilencesHandlerStateFilter(t *testing.T) {
228226
}
229227

230228
// No filter params (all true) - all three states returned.
231-
require.Len(t, callHandler(boolPtr(true), boolPtr(true), boolPtr(true)), 3)
229+
require.Len(t, callHandler(new(true), new(true), new(true)), 3)
232230

233231
// active=false - active silences excluded.
234-
got := stateSet(callHandler(boolPtr(false), boolPtr(true), boolPtr(true)))
232+
got := stateSet(callHandler(new(false), new(true), new(true)))
235233
require.False(t, got["active"])
236234
require.True(t, got["expired"] || got["pending"])
237235

238236
// expired=false - expired silences excluded.
239-
got = stateSet(callHandler(boolPtr(true), boolPtr(false), boolPtr(true)))
237+
got = stateSet(callHandler(new(true), new(false), new(true)))
240238
require.False(t, got["expired"])
241239

242240
// pending=false - pending silences excluded.
243-
got = stateSet(callHandler(boolPtr(true), boolPtr(true), boolPtr(false)))
241+
got = stateSet(callHandler(new(true), new(true), new(false)))
244242
require.False(t, got["pending"])
245243

246244
// all false - empty result.
247-
require.Empty(t, callHandler(boolPtr(false), boolPtr(false), boolPtr(false)))
245+
require.Empty(t, callHandler(new(false), new(false), new(false)))
248246
}
249247

250248
func TestDeleteSilenceHandler(t *testing.T) {

cli/silence_import.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ func addSilenceWorker(ctx context.Context, sclient silence.ClientService, silenc
6262
sid := s.ID
6363
params := silence.NewPostSilencesParams().WithContext(ctx).WithSilence(s)
6464
postOk, err := sclient.PostSilences(params)
65-
var e *silence.PostSilencesNotFound
66-
if errors.As(err, &e) {
65+
if _, ok := errors.AsType[*silence.PostSilencesNotFound](err); ok {
6766
// silence doesn't exists yet, retry to create as a new one
6867
params.Silence.ID = ""
6968
postOk, err = sclient.PostSilences(params)

cluster/tls_transport_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func TestWriteTo(t *testing.T) {
166166

167167
from := fmt.Sprintf("%s:%d", t1.bindAddr, t1.GetAutoBindPort())
168168
to := fmt.Sprintf("%s:%d", t2.bindAddr, t2.GetAutoBindPort())
169-
sent := []byte(("test packet"))
169+
sent := []byte("test packet")
170170
_, err := t1.WriteTo(sent, to)
171171
require.NoError(t, err)
172172
packet := <-t2.PacketCh()
@@ -186,7 +186,7 @@ func BenchmarkWriteTo(b *testing.B) {
186186
b.ResetTimer()
187187
from := fmt.Sprintf("%s:%d", t1.bindAddr, t1.GetAutoBindPort())
188188
to := fmt.Sprintf("%s:%d", t2.bindAddr, t2.GetAutoBindPort())
189-
sent := []byte(("test packet"))
189+
sent := []byte("test packet")
190190

191191
_, err := t1.WriteTo(sent, to)
192192
require.NoError(b, err)
@@ -218,7 +218,7 @@ func TestDialTimeout(t *testing.T) {
218218
to = <-t2.StreamCh()
219219
})
220220

221-
sent := []byte(("test stream"))
221+
sent := []byte("test stream")
222222
m, err := from.Write(sent)
223223
require.NoError(t, err)
224224
require.Positive(t, m)

config/notifiers_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ fields:
383383
{
384384
Title: "first",
385385
Value: "hello",
386-
Short: newBoolPointer(true),
386+
Short: new(true),
387387
},
388388
{
389389
Title: "second",
@@ -393,7 +393,7 @@ fields:
393393
{
394394
Title: "third",
395395
Value: "slack field test",
396-
Short: newBoolPointer(false),
396+
Short: new(false),
397397
},
398398
}
399399

@@ -556,10 +556,6 @@ http_config:
556556
}
557557
}
558558

559-
func newBoolPointer(b bool) *bool {
560-
return &b
561-
}
562-
563559
func TestEmailConfig_UnmarshalYAML(t *testing.T) {
564560
testConfig := []struct {
565561
name string

0 commit comments

Comments
 (0)