Skip to content

Commit 18a51e3

Browse files
authored
chore: unlock go 1.24 (#116)
1 parent f20391d commit 18a51e3

26 files changed

+69
-75
lines changed

.github/workflows/_test_bare_metal.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10-
runs-on: [ macos-15, macos-14, macos-13, ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, windows-latest, arm-4core-linux ]
10+
runs-on: [ macos-15, macos-14, macos-13, ubuntu-24.04, ubuntu-22.04, windows-latest, arm-4core-linux ]
1111
go-version: [ stable, oldstable ]
1212
include:
1313
# Test with DD_APPSEC_WAF_LOG_LEVEL (only latest go version)

.github/workflows/_test_containerized.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,14 @@ jobs:
3131
- golang:{0}-alpine
3232
- golang:{0}-bookworm
3333
- golang:{0}-bullseye
34-
# RPM-based image
35-
- amazonlinux:2 # pretty popular on AWS workloads
36-
- amazonlinux:2023
3734
go-version:
3835
- ${{ needs.go-versions.outputs.stable }}
3936
- ${{ needs.go-versions.outputs.oldstable }}
37+
- tip
4038
include:
4139
# Test with DD_APPSEC_WAF_LOG_LEVEL (only latest go, without any particular tag)
4240
- go-version: ${{ needs.go-versions.outputs.stable }}
4341
waf-log-level: TRACE
44-
exclude:
45-
# The amazonlinux:2 variant is only relevant for the default go version yum ships (currently 1.22)
46-
- go-version: ${{ needs.go-versions.outputs.stable }}
47-
image: amazonlinux:2
48-
# The amazonlinux:2023 variant is only relevant for the default go version yum ships (currently 1.22)
49-
- go-version: ${{ needs.go-versions.outputs.stable }}
50-
image: amazonlinux:2023
5142
name: ${{ matrix.arch }} ${{ format(matrix.image, matrix.go-version) }} go${{ matrix.go-version }}${{ matrix.waf-log-level && format(' (DD_APPSEC_WAF_LOG_LEVEL={0})', matrix.waf-log-level) || '' }}
5243
# We use ARM runners when needed to avoid the performance hit of QEMU
5344
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'arm-4core-linux' }}

.github/workflows/ci.sh

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ contains() {
1717
# Return true if the current OS is not Windows
1818
WAF_ENABLED=$([ "$GOOS" = "windows" ] && echo false || echo true)
1919

20+
if $(contains "$GOVERSION" devel); then
21+
WAF_ENABLED=false
22+
fi
23+
2024
# run is the main function that runs the tests
2125
# It takes 2 arguments:
2226
# - $1: whether the WAF is enabled or not (true or false)
@@ -28,11 +32,6 @@ run() {
2832
test_tags="$2,$GOOS,$GOARCH"
2933
cgo=$($(contains "$2" cgo) && echo 1 || echo 0)
3034

31-
# Go 1.23 does not allow go version build tags
32-
if $(contains "$GOVERSION" go1.23) && $(contains "$test_tags" go1); then
33-
return
34-
fi
35-
3635
echo "Running matrix $test_tags where the WAF is" "$($waf_enabled && echo "supported" || echo "not supported")" "..."
3736
env CGO_ENABLED="$cgo" go test -shuffle=on -tags="$tags" -args -waf-build-tags="$test_tags" -waf-supported="$waf_enabled" ./...
3837

@@ -41,32 +40,23 @@ run() {
4140
fi
4241

4342
if [ "$cgo" = "1" ]; then
44-
echo "Running again with cgocheck enabled..."
45-
env "GOEXPERIMENT=cgocheck2" CGO_ENABLED=1 go test -shuffle=on -tags="$tags" -args -waf-build-tags="$test_tags" -waf-supported="$waf_enabled" ./...
43+
echo "Running again with cgo options (cgocheck & race) enabled..."
44+
env "GOEXPERIMENT=cgocheck2" CGO_ENABLED=1 go test -race -shuffle=on -tags="$tags" -args -waf-build-tags="$test_tags" -waf-supported="$waf_enabled" ./...
4645
fi
4746

48-
# TODO: remove condition once we have native arm64 linux runners
49-
if [ "$GOARCH" = "amd64" ]; then
50-
echo "Running again $nproc times in parralel"
51-
env CGO_ENABLED="$cgo" go test -shuffle=on -parallel $((nproc / 4 + 1)) -count="$nproc" -tags="$tags" -args -waf-build-tags="$test_tags" -waf-supported="$waf_enabled" ./...
52-
fi
47+
echo "Running again $nproc times in parralel"
48+
env CGO_ENABLED="$cgo" go test -shuffle=on -parallel $((nproc / 4 + 1)) -count="$nproc" -tags="$tags" -args -waf-build-tags="$test_tags" -waf-supported="$waf_enabled" ./...
5349
}
5450

5551
run "$WAF_ENABLED" appsec # WAF enabled (but not on windows)
5652
run false # CGO Disabled
57-
run false go1.24 # Too recent go version (not tested)
58-
run false go1.24,appsec # CGO disabled with appsec explicitely enabled but too recent go version
5953
run false datadog.no_waf # WAF manually disabled
6054
run false datadog.no_waf,appsec # CGO disabled with appsec explicitely enabled but WAF manually disabled
61-
run false datadog.no_waf,go1.24 # WAF manually disabled and go version to recent
62-
run false datadog.no_waf,go1.24,appsec # CGO disabled, WAF manually disabled, too recent go version with appsec explicitely enabled
6355

6456
# Check if we are running on Alpine and install the required dependencies for cgo
6557
if [ -f /etc/os-release ] && grep -q Alpine < /etc/os-release; then
6658
apk add gcc musl-dev libc6-compat
6759
fi
6860

6961
run "$WAF_ENABLED" cgo # WAF enabled (but not on windows)
70-
run false go1.24,cgo # CGO enabled and too recent go version
7162
run false datadog.no_waf,cgo # WAF manually disabled and CGO enabled
72-
run false datadog.no_waf,go1.24,cgo # CGO enabled, WAF manually disabled, too recent go version

_tools/libddwaf-updater/update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var (
3232
)
3333

3434
const (
35-
goVersionUnsupported = "go1.24"
35+
goVersionUnsupported = "go1.25"
3636
)
3737

3838
var (

alignement_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Copyright 2016-present Datadog, Inc.
55

66
// Purego only works on linux/macOS with amd64 and arm64 from now
7-
//go:build (linux || darwin) && (amd64 || arm64) && !go1.24 && !datadog.no_waf && (cgo || appsec)
7+
//go:build (linux || darwin) && (amd64 || arm64) && !go1.25 && !datadog.no_waf && (cgo || appsec)
88

99
package waf
1010

encoder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ func depthOf(ctx context.Context, obj reflect.Value) (depth int, err error) {
491491
}
492492
}
493493

494-
// resovlePointer attempts to resolve a pointer while limiting the pointer depth
494+
// resolvePointer attempts to resolve a pointer while limiting the pointer depth
495495
// to be traversed, so that this is not susceptible to an infinite loop when
496496
// provided a self-referencing pointer.
497497
func resolvePointer(obj reflect.Value) (reflect.Value, reflect.Kind) {

encoder_decoder_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// This product includes software developed at Datadog (https://www.datadoghq.com/).
44
// Copyright 2016-present Datadog, Inc.
55

6-
//go:build (amd64 || arm64) && (linux || darwin) && !go1.24 && !datadog.no_waf && (cgo || appsec)
6+
//go:build (amd64 || arm64) && (linux || darwin) && !go1.25 && !datadog.no_waf && (cgo || appsec)
77

88
package waf
99

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module github.com/DataDog/go-libddwaf/v3
22

3-
go 1.21
3+
go 1.23
44

55
require (
6-
github.com/ebitengine/purego v0.6.0-alpha.5
6+
github.com/ebitengine/purego v0.8.2
77
github.com/pkg/errors v0.9.1
88
github.com/stretchr/testify v1.8.4
99
golang.org/x/sys v0.16.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
22
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
33
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4-
github.com/ebitengine/purego v0.6.0-alpha.5 h1:EYID3JOAdmQ4SNZYJHu9V6IqOeRQDBYxqKAg9PyoHFY=
5-
github.com/ebitengine/purego v0.6.0-alpha.5/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ=
4+
github.com/ebitengine/purego v0.8.2 h1:jPPGWs2sZ1UgOSgD2bClL0MJIqu58nOmIcBuXr62z1I=
5+
github.com/ebitengine/purego v0.8.2/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
66
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
77
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
88
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=

handle_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// This product includes software developed at Datadog (https://www.datadoghq.com/).
44
// Copyright 2016-present Datadog, Inc.
55

6-
//go:build (amd64 || arm64) && (linux || darwin) && !go1.24 && !datadog.no_waf && (cgo || appsec)
6+
//go:build (amd64 || arm64) && (linux || darwin) && !go1.25 && !datadog.no_waf && (cgo || appsec)
77

88
package waf
99

0 commit comments

Comments
 (0)