Skip to content

Commit

Permalink
Merge pull request #88 from klihub/devel/bump-golang-1.20
Browse files Browse the repository at this point in the history
go.{mod,sum}, .github: bump minimum golang version to 1.20.
  • Loading branch information
mikebrow authored Jun 7, 2024
2 parents 7977ced + 2c3608d commit f575c3b
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 61 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
timeout-minutes: 5

steps:
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: 1.20.x

Expand All @@ -41,7 +41,7 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: 1.20.x

Expand All @@ -60,12 +60,12 @@ jobs:

strategy:
matrix:
go: [1.19.x, 1.20.x]
go: [1.22.3]
os: [ubuntu-22.04]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

Expand All @@ -76,7 +76,7 @@ jobs:
- uses: golangci/golangci-lint-action@v3
with:
version: v1.51.2
version: v1.58.0

tests:
name: Tests
Expand All @@ -85,11 +85,11 @@ jobs:

strategy:
matrix:
go: [1.19.x, 1.20.x]
go: [1.20.x, 1.21.x, 1.22.3]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: 1.20.x

Expand Down
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ issues:
linters:
- govet
text: "copylocks: .*protobuf/internal/impl.MessageState.*"
# We dot-import ginkgo and gomega in some tests. Silence any related errors.
- path: 'pkg/adaptation|pkg/runtime-tools/generate|pkg/net/multiplex'
text: "dot-imports:"

run:
timeout: 2m
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.19
go 1.20

require (
github.com/containerd/ttrpc v1.2.3
Expand Down
14 changes: 7 additions & 7 deletions pkg/adaptation/adaptation_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ var _ = Describe("Adaptation", func() {
When("SyncFn is nil", func() {
var (
syncFn func(ctx context.Context, cb nri.SyncCB) error
updateFn = func(ctx context.Context, updates []*nri.ContainerUpdate) ([]*nri.ContainerUpdate, error) {
updateFn = func(_ context.Context, _ []*nri.ContainerUpdate) ([]*nri.ContainerUpdate, error) {
return nil, nil
}
)
Expand All @@ -119,7 +119,7 @@ var _ = Describe("Adaptation", func() {
When("UpdateFn is nil", func() {
var (
updateFn func(ctx context.Context, updates []*nri.ContainerUpdate) ([]*nri.ContainerUpdate, error)
syncFn = func(ctx context.Context, cb nri.SyncCB) error {
syncFn = func(_ context.Context, _ nri.SyncCB) error {
return nil
}
)
Expand Down Expand Up @@ -385,7 +385,7 @@ var _ = Describe("Pod and container requests and events", func() {
}

order []*mockPlugin
recordOrder = func(p *mockPlugin, pod *api.PodSandbox, ctr *api.Container) error {
recordOrder = func(p *mockPlugin, _ *api.PodSandbox, _ *api.Container) error {
order = append(order, p)
return nil
}
Expand Down Expand Up @@ -435,7 +435,7 @@ var _ = Describe("Plugin container creation adjustments", func() {
s = &Suite{}
)

adjust := func(subject string, p *mockPlugin, pod *api.PodSandbox, ctr *api.Container, overwrite bool) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) {
adjust := func(subject string, p *mockPlugin, _ *api.PodSandbox, _ *api.Container, overwrite bool) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) {
plugin := p.idx + "-" + p.name
a := &api.ContainerAdjustment{}
switch subject {
Expand Down Expand Up @@ -845,7 +845,7 @@ var _ = Describe("Plugin container updates during creation", func() {
s = &Suite{}
)

update := func(subject, which string, p *mockPlugin, pod *api.PodSandbox, ctr *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) {
update := func(subject, which string, p *mockPlugin, _ *api.PodSandbox, ctr *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) {
plugin := p.idx + "-" + p.name

if which != plugin && which != "*" && which != "both" {
Expand Down Expand Up @@ -1216,7 +1216,7 @@ var _ = Describe("Solicited container updates by plugins", func() {
s = &Suite{}
)

update := func(subject, which string, p *mockPlugin, pod *api.PodSandbox, ctr *api.Container, r, exp *api.LinuxResources) ([]*api.ContainerUpdate, error) {
update := func(subject, which string, p *mockPlugin, _ *api.PodSandbox, ctr *api.Container, _, _ *api.LinuxResources) ([]*api.ContainerUpdate, error) {
plugin := p.idx + "-" + p.name

if which != plugin && which != "*" && which != "both" {
Expand Down Expand Up @@ -1807,7 +1807,7 @@ var _ = Describe("Unsolicited container update requests", func() {
recordedUpdates []*nri.ContainerUpdate
)

runtime.updateFn = func(ctx context.Context, updates []*nri.ContainerUpdate) ([]*nri.ContainerUpdate, error) {
runtime.updateFn = func(_ context.Context, updates []*nri.ContainerUpdate) ([]*nri.ContainerUpdate, error) {
recordedUpdates = updates
return nil, nil
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/adaptation/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func (r *result) adjust(rpl *ContainerAdjustment, plugin string) error {
if err := r.adjustEnv(rpl.Env, plugin); err != nil {
return err
}
if err := r.adjustHooks(rpl.Hooks, plugin); err != nil {
if err := r.adjustHooks(rpl.Hooks); err != nil {
return err
}
if rpl.Linux != nil {
Expand Down Expand Up @@ -458,7 +458,7 @@ func splitEnvVar(s string) (string, string) {
return split[0], split[1]
}

func (r *result) adjustHooks(hooks *Hooks, plugin string) error {
func (r *result) adjustHooks(hooks *Hooks) error {
if hooks == nil {
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/adaptation/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ func (m *mockPlugin) onClose() {
}
}

func (m *mockPlugin) Configure(_ context.Context, cfg, runtime, version string) (stub.EventMask, error) {
func (m *mockPlugin) Configure(_ context.Context, _, _, _ string) (stub.EventMask, error) {
m.q.Add(PluginConfigured)

return m.mask, nil
Expand Down Expand Up @@ -690,7 +690,7 @@ func (q *EventQ) Add(e *Event) {
}
}

func (q *EventQ) Reset(e *Event) {
func (q *EventQ) Reset() {
q.Lock()
defer q.Unlock()
q.q = []*Event{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
)

// FromOCILinuxResources returns resources from an OCI runtime Spec.
func FromOCILinuxResources(o *rspec.LinuxResources, ann map[string]string) *LinuxResources {
func FromOCILinuxResources(o *rspec.LinuxResources, _ map[string]string) *LinuxResources {
if o == nil {
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/net/multiplex/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,16 +429,16 @@ func (c *conn) RemoteAddr() net.Addr {
}

// SetDeadline is the unimplemented stub for the corresponding net.Conn function.
func (c *conn) SetDeadline(t time.Time) error {
func (c *conn) SetDeadline(_ time.Time) error {
return nil
}

// SetReadDeadline is the unimplemented stub for the corresponding net.Conn function.
func (c *conn) SetReadDeadline(t time.Time) error {
func (c *conn) SetReadDeadline(_ time.Time) error {
return nil
}

// SetWriteDeadline is the unimplemented stub for the corresponding net.Conn function.
func (c *conn) SetWriteDeadline(t time.Time) error {
func (c *conn) SetWriteDeadline(_ time.Time) error {
return nil
}
29 changes: 0 additions & 29 deletions pkg/net/net_suite_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/stub/stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ func (stub *stub) Synchronize(ctx context.Context, req *api.SynchronizeRequest)
}

// Shutdown the plugin.
func (stub *stub) Shutdown(ctx context.Context, req *api.ShutdownRequest) (*api.ShutdownResponse, error) {
func (stub *stub) Shutdown(ctx context.Context, _ *api.ShutdownRequest) (*api.ShutdownResponse, error) {
handler := stub.handlers.Shutdown
if handler != nil {
handler(ctx)
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.18
go 1.20

require (
github.com/containerd/nri v0.2.0
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.18
go 1.20

require (
github.com/containerd/nri v0.2.0
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.18
go 1.20

require (
github.com/containerd/nri v0.2.0
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.18
go 1.20

require (
github.com/containerd/nri v0.2.0
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.18
go 1.20

require (
github.com/containerd/nri v0.2.0
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.19
go 1.20

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.18
go 1.20

require (
github.com/containerd/containerd v1.6.9
Expand Down

0 comments on commit f575c3b

Please sign in to comment.