Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump up golang to 1.22.0 #132

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: 1.22.x

- name: Set env
shell: bash
Expand All @@ -43,7 +43,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: 1.22.x

# needed for wasm plugins
- uses: acifani/setup-tinygo@v2
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:

strategy:
matrix:
go: [1.22.3]
go: [1.22.x, 1.23.x]
os: [ubuntu-22.04]

steps:
Expand All @@ -103,7 +103,7 @@ jobs:

strategy:
matrix:
go: [1.21.x, 1.22.3]
go: [1.22.x, 1.23.x]

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ build-plugins: $(PLUGINS)
build-check:
$(Q)$(GO_BUILD) -v $(GO_MODULES)

mod-tidy:
$(Q)$(GO_CMD) mod tidy
$(Q)./scripts/go-mod-tidy

#
# clean targets
#
Expand Down
6 changes: 3 additions & 3 deletions examples/go.mod
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
module github.com/containerd/nri/examples

go 1.18
go 1.22.0

require (
github.com/containerd/cgroups v1.0.3
github.com/containerd/nri v0.1.0
github.com/opencontainers/runtime-spec v1.0.3-0.20220825212826-86290f6a00fb
github.com/sirupsen/logrus v1.8.1
github.com/sirupsen/logrus v1.9.3
)

require (
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/godbus/dbus/v5 v5.0.4 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/sys v0.21.0 // indirect
)

replace github.com/containerd/nri => ../
12 changes: 8 additions & 4 deletions examples/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down Expand Up @@ -66,8 +68,9 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
Expand All @@ -86,3 +89,4 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/containerd/nri

go 1.21
go 1.22.0

require (
github.com/containerd/ttrpc v1.2.6-0.20240827082320-b5cd6e4b3287
Expand Down
2 changes: 1 addition & 1 deletion plugins/device-injector/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/containerd/nri/plugins/device-injector

go 1.21
go 1.22.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there a specific need to raise the minimum required version? Go modules use minimum versions selection; that includes the go versions, and for library modules should specify the absolute minimum that can be used. eg golang's x/sys and others still allow go1.18, because the did not require anything more current; https://github.com/golang/sys/blob/d4ac05dc8c4c953ec29cae3df56c0833f4010763/go.mod#L3

Copy link
Member Author

@djdongjin djdongjin Dec 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @thaJeztah thanks for review and suggestion. (moved PR to draft for now since need to fix CI errors)

Was there a specific need to raise the minimum required version?

There is no required need for this go update. It's mainly to make our dependency upgrade easier. E.g., from my experiment, both google.golang.org/grpc and k8s.io/cri-api updates require go 1.22 at least. I probably can find a relatively new version for them that still only requires go 1.21.

That being said, I'm happy to change it back to go 1.21 and update those deps to the versions that only requires go 1.21. :)

and for library modules should specify the absolute minimum that can be used.

I assume we still want to keep the versions in plugins to be up-to-date (e.g., at least uses a non-EOL version if possible)? E.g., keep ./go.mod at minimum, and update ./plugins/*/go.mod relatively frequently?

Meanwhile, a few clarification questions on go/deps around containerd projects:

  • For libraries, do we want to update go version if it's needed to update some major deps (e.g., k8s.io, otel, grpc, etc).
  • Do we need to keep the library's dependency version in sync with containerd?

Thank you!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For libraries, do we want to update go version if it's needed to update some major deps (e.g., k8s.io, otel, grpc, etc).

Roughly yes, though a couple thoughts on this:

  • Distro packagers of containerd may be using older versions of Go that are unsupported upstream, but still maintained by the distro. This would be the policy for stable distributions like Debian and Fedora, for example. Bumping too aggressively makes it difficult for packagers to still support containerd.
  • CI should cover in-support versions of Go
  • We may want to bump anyway once a version becomes too old, though that's still a bit fuzzy. We could look at when popular distros like Debian and Fedora phase out a given Go version as an example.

Do we need to keep the library's dependency version in sync with containerd?

No, but we definitely should test it (in CI) at a version in sync with containerd.


require (
github.com/containerd/nri v0.6.1
Expand Down
2 changes: 1 addition & 1 deletion plugins/differ/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/containerd/nri/plugins/differ

go 1.21
go 1.22.0

require (
github.com/containerd/nri v0.6.1
Expand Down
2 changes: 1 addition & 1 deletion plugins/hook-injector/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/containerd/nri/plugins/hook-injector

go 1.21
go 1.22.0

require (
github.com/containerd/nri v0.6.1
Expand Down
2 changes: 1 addition & 1 deletion plugins/logger/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/containerd/nri/plugins/logger

go 1.21
go 1.22.0

require (
github.com/containerd/nri v0.6.1
Expand Down
2 changes: 1 addition & 1 deletion plugins/network-logger/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/containerd/nri/plugins/network-logger

go 1.21
go 1.22.0

require (
github.com/containerd/nri v0.6.1
Expand Down
2 changes: 1 addition & 1 deletion plugins/template/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/containerd/nri/plugins/template

go 1.21
go 1.22.0

require (
github.com/containerd/nri v0.6.1
Expand Down
2 changes: 1 addition & 1 deletion plugins/ulimit-adjuster/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/containerd/nri/plugins/ulimit-adjuster

go 1.21
go 1.22.0

replace github.com/containerd/nri => ../..

Expand Down
2 changes: 1 addition & 1 deletion plugins/v010-adapter/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/containerd/nri/plugins/v010-adapter

go 1.21
go 1.22.0

require (
github.com/containerd/containerd v1.6.9
Expand Down
2 changes: 1 addition & 1 deletion plugins/wasm/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/containerd/nri/plugins/wasm

go 1.21
go 1.22.0

require github.com/containerd/nri v0.6.1

Expand Down
28 changes: 28 additions & 0 deletions scripts/go-mod-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# Copyright The containerd Authors.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#
# Run go mod tidy in all go modules
#
set -eu -o pipefail

find . -name go.mod | while read -r gomod; do
dir=$(dirname "$gomod")

pushd "$dir"
go mod tidy
popd
done
Loading