Skip to content

Commit 59f4db0

Browse files
committed
Upgrade: Go 1.24, Auth 4.9, golangci-lint v2
- Upgrade pdns-auth from 4.8.5 to 4.9.4 (no changes needed) - Upgrade from Go 1.19 to 1.24 - Upgrade golangci-lint to the latest v2, which has a different configuration structure - Minor code changes to make the new linters happy
1 parent 103892a commit 59f4db0

File tree

8 files changed

+72
-43
lines changed

8 files changed

+72
-43
lines changed

.golangci.yml

Lines changed: 57 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,62 @@
1-
# See https://github.com/golangci/golangci-lint/blob/master/.golangci.yml for more examples
1+
version: "2"
22

33
linters:
4-
enabled:
5-
# In addition to default standard linters (see: golangci-lint help linters)
6-
# Try extra ones line this: golangci-lint run --disable-all --enable=lll
7-
- goimports
8-
# For future consideration (requires some extra work, but suggestions look useful)
9-
# - gocritic
10-
# - golint # can sometimes be a bit pedantic
11-
# - lll
12-
13-
run:
14-
skip-files: []
15-
16-
linters-settings:
4+
settings:
175
govet:
18-
# settings per analyzer
19-
settings:
20-
printf: # analyzer name, run `go tool vet help` to see all analyzers
21-
funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer
22-
- (*github.com/sirupsen/logrus.Entry).Debugf
23-
- (*github.com/sirupsen/logrus.Entry).Infof
24-
- (*github.com/sirupsen/logrus.Entry).Logf
25-
- (*github.com/sirupsen/logrus.Entry).Warnf
26-
- (*github.com/sirupsen/logrus.Entry).Errorf
27-
- (*github.com/sirupsen/logrus.Entry).Fatalf
28-
- github.com/sirupsen/logrus.Debugf
29-
- github.com/sirupsen/logrus.Infof
30-
- github.com/sirupsen/logrus.Logf
31-
- github.com/sirupsen/logrus.Warnf
32-
- github.com/sirupsen/logrus.Errorf
33-
- github.com/sirupsen/logrus.Fatalf
6+
settings:
7+
printf:
8+
funcs:
9+
- (*github.com/sirupsen/logrus.Entry).Debugf
10+
- (*github.com/sirupsen/logrus.Entry).Infof
11+
- (*github.com/sirupsen/logrus.Entry).Logf
12+
- (*github.com/sirupsen/logrus.Entry).Warnf
13+
- (*github.com/sirupsen/logrus.Entry).Errorf
14+
- (*github.com/sirupsen/logrus.Entry).Fatalf
15+
- github.com/sirupsen/logrus.Debugf
16+
- github.com/sirupsen/logrus.Infof
17+
- github.com/sirupsen/logrus.Logf
18+
- github.com/sirupsen/logrus.Warnf
19+
- github.com/sirupsen/logrus.Errorf
20+
- github.com/sirupsen/logrus.Fatalf
21+
staticcheck:
22+
checks:
23+
- "all"
24+
# excluded by default
25+
#- "-ST1000"
26+
#- "-ST1003"
27+
#- "-ST1016"
28+
#- "-ST1020"
29+
#- "-ST1021"
30+
#- "-ST1022"
31+
# Allow `createIsSet := false` initialization for clarity
32+
- "-QF1007"
33+
34+
exclusions:
35+
generated: lax
36+
presets:
37+
- comments
38+
- common-false-positives
39+
- legacy
40+
- std-error-handling
41+
rules:
42+
- path: _test\.go
43+
text: lmdbenv.KVString struct literal uses unkeyed fields
44+
paths:
45+
- third_party$
46+
- builtin$
47+
- examples$
3448

35-
issues:
36-
exclude-rules:
37-
# Ignore complaints about using lmdbenv.KVString without labels in tests
38-
- path: _test\.go
39-
text: lmdbenv.KVString struct literal uses unkeyed fields
49+
formatters:
50+
enable:
51+
- goimports
52+
settings:
53+
goimports:
54+
local-prefixes:
55+
- powerdns.com
56+
exclusions:
57+
generated: lax
58+
paths:
59+
- third_party$
60+
- builtin$
61+
- examples$
4062

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Builder
22
# Note: Not using Alpine, because of CGo deps
3-
FROM golang:1.19-buster as builder
3+
FROM golang:1.24-bookworm as builder
44
ENV GOBIN=/usr/local/bin
55
ARG GOPROXY=
66

77
# GOFLAGS workaround for Go 1.19 when building from subrepos
88
# Issue: https://github.com/golang/go/issues/53640
9+
# TODO: Check if still needed for 1.24+
910
ARG GOFLAGS
1011
ENV GOFLAGS ${GOFLAGS}
1112

@@ -18,6 +19,8 @@ RUN echo "GOFLAGS=$GOFLAGS"; go install ./cmd/...
1819

1920
# Dist
2021
# Note: When using Alpine, ls prevents auth api from correctly functioning (most likely some locking issue)
22+
# Reason: When you have multiple processing accessing the same LMDB, they MUST use the same libc, otherwise
23+
# way file locking is done will conflict.
2124
FROM debian:buster-slim
2225

2326
RUN ulimit -n 2000 \

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ services:
2323
- "minio:/data"
2424

2525
auth1:
26-
image: powerdns/pdns-auth-48
26+
image: powerdns/pdns-auth-49
2727
environment:
2828
instance: 1
2929
port: 53
@@ -40,7 +40,7 @@ services:
4040
entrypoint: /run.sh
4141

4242
auth2:
43-
image: powerdns/pdns-auth-48
43+
image: powerdns/pdns-auth-49
4444
environment:
4545
instance: 2
4646
port: 53
@@ -57,7 +57,7 @@ services:
5757
entrypoint: /run.sh
5858

5959
auth3:
60-
image: powerdns/pdns-auth-48
60+
image: powerdns/pdns-auth-49
6161
environment:
6262
instance: 3
6363
port: 53

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/PowerDNS/lightningstream
22

3-
go 1.19
3+
go 1.24
44

55
require (
66
github.com/CrowdStrike/csproto v0.23.1

go.sum

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
204204
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
205205
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
206206
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
207+
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
207208
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
208209
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
209210
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
@@ -309,6 +310,7 @@ github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn
309310
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
310311
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
311312
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
313+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
312314
github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w=
313315
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
314316
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
@@ -355,6 +357,7 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY
355357
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
356358
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
357359
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
360+
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
358361
github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso=
359362
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
360363
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
@@ -773,6 +776,7 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
773776
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
774777
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
775778
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
779+
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
776780
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
777781
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
778782
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -933,6 +937,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
933937
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
934938
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
935939
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
940+
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
936941
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
937942
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
938943
gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=

lmdbenv/strategy/append.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
// - Sorted input
2020
//
2121
// Uses: make the very first snapshot load fast.
22-
//
2322
func Append(txn *lmdb.Txn, dbi lmdb.DBI, it Iterator) error {
2423
prevKey := make([]byte, 0, LMDBMaxKeySize)
2524
for {

status/httpd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,6 @@ func (p *Page) ServeHTTP(w http.ResponseWriter, r *http.Request) {
177177
err := statusTemplate.Execute(w, data)
178178
if err != nil {
179179
w.WriteHeader(500)
180-
_, _ = w.Write([]byte(fmt.Sprintf("Template execution error: %v", err)))
180+
_, _ = fmt.Fprintf(w, "Template execution error: %v", err)
181181
}
182182
}

test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ GOMAXPROCS=1 go test -race -count=5 "$@" ./...
2222
go test -count 20 -run TestSyncer_Sync_startup ./syncer
2323

2424
# Configure linters in .golangci.yml
25-
GOBIN="$PWD/bin" go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.0
25+
GOBIN="$PWD/bin" go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.0.2
2626
./bin/golangci-lint run
2727

0 commit comments

Comments
 (0)