Skip to content

Commit 445523d

Browse files
api: explicitly disable future go versions (#19)
purego is panic'ing on go1.21's release candidate, which will be released in August. With this PR, we will start enforcing the set of Go versions we know we support and explicitly disable future Go versions until we tested them ourselves. As a result, Go 1.21 is disabled for now until a fix is figured out. --------- Co-authored-by: Eliott Bouhana <[email protected]> Co-authored-by: Julio Guerra<[email protected]>
1 parent 0cbeaae commit 445523d

16 files changed

+66
-44
lines changed

.github/workflows/test.yml

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,58 +9,55 @@ on:
99
- main
1010
env:
1111
DD_APPSEC_WAF_TIMEOUT: 5s
12-
GODEBUG: cgocheck=2 # highest level of run-time cgo checks
1312
jobs:
1413
native:
1514
strategy:
15+
fail-fast: false
1616
matrix:
1717
runs-on: [ macos-13, macos-12, macos-11, ubuntu-22.04, ubuntu-20.04, windows-latest ]
1818
go-version: [ "1.20", "1.19", "1.18" ]
19-
cgo_enabled: # test it compiles with and without cgo
20-
- 0
21-
- 1
22-
fail-fast: false
19+
cgo_enabled: [ "0", "1" ] # test it compiles with and without cgo
20+
include:
21+
- env:
22+
GODEBUG=cgocheck=2
2323
runs-on: ${{ matrix.runs-on }}
2424
steps:
2525
- uses: actions/checkout@v3
26-
- uses: actions/setup-go@v3
26+
- uses: actions/setup-go@v4
2727
with:
2828
go-version: ${{ matrix.go-version }}
2929
cache: true
3030

31-
- name: Go modules cache
32-
uses: actions/cache@v3
33-
with:
34-
path: ~/go/pkg/mod
35-
key: go-pkg-mod-${{ hashFiles('**/go.sum') }}
36-
restore-keys: go-pkg-mod-
37-
3831
- name: go test
3932
shell: bash
4033
run: |
4134
# Install gotestsum
4235
env GOBIN=$PWD go install gotest.tools/gotestsum@latest
4336
# Run the tests with gotestsum
44-
env CGO_ENABLED=${{ matrix.cgo_enabled }} ./gotestsum -- -v -count=10 -shuffle=on ./...
37+
env ${{ matrix.env }} CGO_ENABLED=${{ matrix.cgo_enabled }} ./gotestsum -- -v -count=10 -shuffle=on ./...
4538
4639
# Same tests but on the official golang container for linux
4740
golang-linux-container:
4841
runs-on: ubuntu-latest
4942
container:
5043
image: golang:${{ matrix.go-version }}-${{ matrix.distribution }}
5144
strategy:
52-
matrix:
53-
go-version: [ "1.20", "1.19", "1.18" ]
54-
distribution: [ bullseye, buster, alpine ]
55-
cgo_enabled: # test it compiles with and without cgo
56-
- 0
57-
- 1
5845
fail-fast: false
46+
matrix:
47+
go-version: [ "1.21-rc", "1.20", "1.19", "1.18" ]
48+
distribution: [ bookworm, bullseye, buster, alpine ]
49+
cgo_enabled: [ "0", "1" ] # test it compiles with and without cgo
50+
exclude:
51+
- go-version: 1.18
52+
distribution: bookworm
53+
- go-version: 1.21-rc
54+
distribution: buster
5955
steps:
6056
- uses: actions/checkout@v3
57+
6158
# Install gcc and the libc headers on alpine images
6259
- if: ${{ matrix.distribution == 'alpine' }}
63-
run: apk add gcc musl-dev libc6-compat git
60+
run: apk add gcc musl-dev libc6-compat
6461

6562
- name: Go modules cache
6663
uses: actions/cache@v3
@@ -80,9 +77,7 @@ jobs:
8077
runs-on: ubuntu-latest
8178
strategy:
8279
matrix:
83-
cgo_enabled: # test it compiles with and without the cgo
84-
- 0
85-
- 1
80+
cgo_enabled: [ "0", "1" ] # test it compiles with and without the cgo
8681
fail-fast: false
8782
steps:
8883
- uses: actions/checkout@v3

ctypes_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)
7+
//go:build (linux || darwin) && (amd64 || arm64) && !go1.21
88

99
package waf
1010

embed_darwin_amd64.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 darwin && amd64
6+
//go:build darwin && amd64 && !go1.21
77

88
package waf
99

embed_darwin_arm64.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 darwin && arm64
6+
//go:build darwin && arm64 && !go1.21
77

88
package waf
99

embed_linux_amd64.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 linux && amd64
6+
//go:build linux && amd64 && !go1.21
77

88
package waf
99

embed_linux_arm64.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 linux && arm64
6+
//go:build linux && arm64 && !go1.21
77

88
package waf
99

lib_dl.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)
7+
//go:build (linux || darwin) && (amd64 || arm64) && !go1.21
88

99
package waf
1010

symbols_linux_cgo.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 cgo && linux
6+
//go:build cgo && linux && !go1.21
77

88
package waf
99

symbols_linux_purego.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 !cgo && linux
6+
//go:build !cgo && linux && !go1.21
77

88
package waf
99

waf_dl.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 (linux || darwin) && (amd64 || arm64)
6+
//go:build (linux || darwin) && (amd64 || arm64) && !go1.21
77

88
package waf
99

0 commit comments

Comments
 (0)