Skip to content

Commit 865224d

Browse files
authored
Merge pull request #4292 from kolyshkin/go122
Stop blacklisting Go 1.22+, drop Go < 1.21 support, use Go 1.22 in CI
2 parents a35a4c6 + 3019e84 commit 865224d

File tree

13 files changed

+26
-81
lines changed

13 files changed

+26
-81
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
fail-fast: false
2525
matrix:
2626
os: [ubuntu-20.04, ubuntu-24.04, actuated-arm64-6cpu-8gb]
27-
go-version: [1.20.x, 1.21.x]
27+
go-version: [1.21.x, 1.22.x]
2828
rootless: ["rootless", ""]
2929
race: ["-race", ""]
3030
criu: ["", "criu-dev"]
@@ -33,7 +33,7 @@ jobs:
3333
# Disable most of criu-dev jobs, as they are expensive
3434
# (need to compile criu) and don't add much value/coverage.
3535
- criu: criu-dev
36-
go-version: 1.20.x
36+
go-version: 1.21.x
3737
- criu: criu-dev
3838
rootless: rootless
3939
- criu: criu-dev
@@ -45,12 +45,12 @@ jobs:
4545
- dmz: runc_nodmz
4646
os: ubuntu-20.04
4747
- dmz: runc_nodmz
48-
go-version: 1.20.x
48+
go-version: 1.21.x
4949
- dmz: runc_nodmz
5050
rootless: rootless
5151
- dmz: runc_nodmz
5252
race: -race
53-
- go-version: 1.20.x
53+
- go-version: 1.21.x
5454
os: actuated-arm64-6cpu-8gb
5555
- race: "-race"
5656
os: actuated-arm64-6cpu-8gb
@@ -147,6 +147,7 @@ jobs:
147147
uses: actions/setup-go@v5
148148
with:
149149
go-version: ${{ matrix.go-version }}
150+
check-latest: true
150151

151152
- name: build
152153
env:
@@ -225,7 +226,8 @@ jobs:
225226
- name: install go
226227
uses: actions/setup-go@v5
227228
with:
228-
go-version: 1.21.x # TODO: switch to 1.x (latest stable) once Go 1.22 vs glibc issue is fixed.
229+
go-version: 1.x # Latest stable
230+
check-latest: true
229231

230232
- name: unit test
231233
env:

.github/workflows/validate.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- release-*
99
pull_request:
1010
env:
11-
GO_VERSION: 1.20.x
11+
GO_VERSION: 1.22.x
1212
permissions:
1313
contents: read
1414

@@ -117,6 +117,7 @@ jobs:
117117
uses: actions/setup-go@v5
118118
with:
119119
go-version: "${{ env.GO_VERSION }}"
120+
check-latest: true
120121
- name: verify deps
121122
run: make verify-dependencies
122123

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG GO_VERSION=1.21
1+
ARG GO_VERSION=1.22
22
ARG BATS_VERSION=v1.9.0
33
ARG LIBSECCOMP_VERSION=2.5.5
44

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ A third party security audit was performed by Cure53, you can see the full repor
2727

2828
## Building
2929

30-
`runc` only supports Linux. It must be built with Go version 1.19 or higher.
30+
`runc` only supports Linux. It must be built with Go version 1.21 or higher.
31+
32+
NOTE: if building with Go 1.22.x, make sure to use 1.22.4 or a later version
33+
(see [issue #4233](https://github.com/opencontainers/runc/issues/4233) for
34+
more details).
3135

3236
In order to enable seccomp support you will need to install `libseccomp` on your platform.
3337
> e.g. `libseccomp-devel` for CentOS, or `libseccomp-dev` for Ubuntu

go.mod

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

3-
go 1.20
3+
go 1.21
44

55
require (
66
github.com/checkpoint-restore/go-criu/v6 v6.3.0

go.sum

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,19 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
1717
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
1818
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
1919
github.com/frankban/quicktest v1.14.5 h1:dfYrrRyLtiqT9GyKXgdh+k4inNeTvmGbuSgZ3lx3GhA=
20+
github.com/frankban/quicktest v1.14.5/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
2021
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
2122
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
2223
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
2324
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
2425
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
2526
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
27+
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
2628
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
2729
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
30+
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
2831
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
32+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
2933
github.com/moby/sys/mountinfo v0.7.1 h1:/tTvQaSJRr2FshkhXiIpux6fQ2Zvc4j7tAhMTStAG2g=
3034
github.com/moby/sys/mountinfo v0.7.1/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI=
3135
github.com/moby/sys/user v0.1.0 h1:WmZ93f5Ux6het5iituh9x2zAG7NFY9Aqi49jjE1PaQg=
@@ -39,6 +43,7 @@ github.com/opencontainers/selinux v1.11.0/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M5
3943
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
4044
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
4145
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
46+
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
4247
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
4348
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
4449
github.com/seccomp/libseccomp-golang v0.10.0 h1:aA4bp+/Zzi0BnWZ2F1wgNBs5gTpm+na2rWM6M9YjLpY=

libcontainer/cgroups/utils.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,7 @@ func RemovePaths(paths map[string]string) (err error) {
275275
}
276276
}
277277
if len(paths) == 0 {
278-
//nolint:ineffassign,staticcheck // done to help garbage collecting: opencontainers/runc#2506
279-
// TODO: switch to clear once Go < 1.21 is not supported.
280-
paths = make(map[string]string)
278+
clear(paths)
281279
return nil
282280
}
283281
return fmt.Errorf("Failed to remove paths: %v", paths)

libcontainer/container_linux.go

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"path"
1111
"path/filepath"
1212
"reflect"
13+
"slices"
1314
"strconv"
1415
"strings"
1516
"sync"
@@ -452,16 +453,6 @@ func (c *Container) includeExecFifo(cmd *exec.Cmd) error {
452453
return nil
453454
}
454455

455-
// No longer needed in Go 1.21.
456-
func slicesContains[S ~[]E, E comparable](slice S, needle E) bool {
457-
for _, val := range slice {
458-
if val == needle {
459-
return true
460-
}
461-
}
462-
return false
463-
}
464-
465456
func isDmzBinarySafe(c *configs.Config) bool {
466457
// Because we set the dumpable flag in nsexec, the only time when it is
467458
// unsafe to use runc-dmz is when the container process would be able to
@@ -472,9 +463,9 @@ func isDmzBinarySafe(c *configs.Config) bool {
472463
// inheritable, or ambient sets). Luckily, most containers do not have this
473464
// capability.
474465
if c.Capabilities == nil ||
475-
(!slicesContains(c.Capabilities.Bounding, "CAP_SYS_PTRACE") &&
476-
!slicesContains(c.Capabilities.Inheritable, "CAP_SYS_PTRACE") &&
477-
!slicesContains(c.Capabilities.Ambient, "CAP_SYS_PTRACE")) {
466+
(!slices.Contains(c.Capabilities.Bounding, "CAP_SYS_PTRACE") &&
467+
!slices.Contains(c.Capabilities.Inheritable, "CAP_SYS_PTRACE") &&
468+
!slices.Contains(c.Capabilities.Ambient, "CAP_SYS_PTRACE")) {
478469
return true
479470
}
480471

libcontainer/eaccess_go119.go

Lines changed: 0 additions & 17 deletions
This file was deleted.

libcontainer/eaccess_stub.go

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)