Skip to content

Commit 9576907

Browse files
Bump Go min version to Go 1.23 (#805)
* Bump Go min version to Go 1.23 Signed-off-by: Austin Vazquez <[email protected]> * Resolve lint warnings for golangci-lint v1.64.2 Signed-off-by: Austin Vazquez <[email protected]> --------- Signed-off-by: Austin Vazquez <[email protected]>
1 parent e5a3c77 commit 9576907

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+163
-159
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
os: ['ubuntu-20.04', 'ubuntu-22.04']
17-
go: ['1.21', '1.22']
17+
go: ['1.23', '1.24']
1818
# Build all variants regardless of failures
1919
fail-fast: false
2020

.golangci.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ linters:
55
disable-all: true
66
enable:
77
- govet
8+
- copyloopvar
89
- staticcheck
9-
# - unused
1010
- gosimple
1111
- ineffassign
1212
- typecheck
@@ -19,15 +19,29 @@ linters:
1919
- gocritic
2020
- gofmt
2121
- revive
22-
- exportloopref
2322

2423
issues:
2524
exclude-use-default: false
2625
exclude:
2726
- G104 # Errors unhandled
2827
- G103 # Use of unsafe calls should be audited
28+
- G114 # Use of net/http serve function without timeouts.
29+
- G115 # Integer overflow conversion should be audited
2930
- G204 # Subprocess launched with variable
31+
- G301 # Expect directory permissions to be 0750 or less
3032
- G304 # Potential file inclusion via variable
3133
- G306 # WriteFile permissions 0600 or less to be audited
3234
- G307 # Deferring unsafe method "Close" on type "*os.File" to be audited
33-
-
35+
- G404 # Use of weak random number generator
36+
exclude-rules:
37+
- linters:
38+
- govet
39+
text: "copylocks"
40+
- linters:
41+
- revive
42+
text: package-comments
43+
- linters:
44+
- staticcheck
45+
text: "Do not rely on the global seed"
46+
exclude-dirs:
47+
- snapshotter/internal/integtest/stargz # Code copied from upstream stargz

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ SUBMODULES=_submodules
2828
UID:=$(shell id -u)
2929
GID:=$(shell id -g)
3030

31-
FIRECRACKER_CONTAINERD_BUILDER_IMAGE?=golang:1.21-bullseye
31+
FIRECRACKER_CONTAINERD_BUILDER_IMAGE?=golang:1.23-bullseye
3232
export FIRECRACKER_CONTAINERD_TEST_IMAGE?=localhost/firecracker-containerd-test
3333
export GO_CACHE_VOLUME_NAME?=gocache
3434

@@ -136,7 +136,7 @@ tidy:
136136
./tools/tidy.sh
137137

138138
$(BINPATH)/golangci-lint:
139-
GOBIN=$(BINPATH) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2
139+
GOBIN=$(BINPATH) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.2
140140
$(BINPATH)/golangci-lint --version
141141

142142
$(BINPATH)/git-validation:

agent/drive_handler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import (
2121
"strings"
2222
"time"
2323

24-
"github.com/containerd/containerd/log"
2524
"github.com/containerd/containerd/mount"
2625
"github.com/containerd/containerd/protobuf/types"
26+
"github.com/containerd/log"
2727
"github.com/firecracker-microvm/firecracker-containerd/internal"
2828
drivemount "github.com/firecracker-microvm/firecracker-containerd/proto/service/drivemount/ttrpc"
2929
)
@@ -214,7 +214,7 @@ func (dh driveHandler) MountDrive(ctx context.Context, req *drivemount.MountDriv
214214
return nil, fmt.Errorf("exhausted retries mounting drive from %q to %q", drive.Path(), req.DestinationPath)
215215
}
216216

217-
func (dh driveHandler) UnmountDrive(ctx context.Context, req *drivemount.UnmountDriveRequest) (*types.Empty, error) {
217+
func (dh driveHandler) UnmountDrive(_ context.Context, req *drivemount.UnmountDriveRequest) (*types.Empty, error) {
218218
drive, ok := dh.GetDrive(req.DriveID)
219219
if !ok {
220220
return nil, fmt.Errorf("drive %q could not be found", req.DriveID)

agent/error_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ func TestIsRetryableMountError(t *testing.T) {
5555
}
5656

5757
for _, c := range cases {
58-
c := c // see https://github.com/kyoh86/scopelint/issues/4
5958
t.Run(c.Name, func(t *testing.T) {
6059
assert.Equal(t, c.Expected, isRetryableMountError(c.Error))
6160
})

agent/ioproxy_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717
"context"
1818

1919
task "github.com/containerd/containerd/api/runtime/task/v2"
20-
"github.com/containerd/containerd/log"
2120
"github.com/containerd/containerd/protobuf/types"
21+
"github.com/containerd/log"
2222
"github.com/firecracker-microvm/firecracker-containerd/internal/vm"
2323
ioproxy "github.com/firecracker-microvm/firecracker-containerd/proto/service/ioproxy/ttrpc"
2424
)

agent/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import (
2323

2424
taskAPI "github.com/containerd/containerd/api/runtime/task/v2"
2525
"github.com/containerd/containerd/events/exchange"
26-
"github.com/containerd/containerd/log"
2726
"github.com/containerd/containerd/namespaces"
2827
"github.com/containerd/containerd/sys/reaper"
28+
"github.com/containerd/log"
2929
"github.com/containerd/ttrpc"
3030
"github.com/firecracker-microvm/firecracker-go-sdk/vsock"
3131
"github.com/opencontainers/runc/libcontainer/system"

agent/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ import (
2525
taskAPI "github.com/containerd/containerd/api/runtime/task/v2"
2626
"github.com/containerd/containerd/cio"
2727
"github.com/containerd/containerd/identifiers"
28-
"github.com/containerd/containerd/log"
2928
"github.com/containerd/containerd/mount"
3029
"github.com/containerd/containerd/protobuf/types"
3130
runc "github.com/containerd/containerd/runtime/v2/runc/v2"
3231
"github.com/containerd/containerd/runtime/v2/shim"
32+
"github.com/containerd/log"
3333
"github.com/hashicorp/go-multierror"
3434
"github.com/sirupsen/logrus"
3535
"golang.org/x/sys/unix"

docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ You need to have the following things in order to use firecracker-containerd:
4040
* git
4141
* gcc, required by the Firecracker agent for building
4242
* A recent installation of [Docker CE](https://docker.com).
43-
* Go 1.21 or later, which you can download from [here](https://golang.org/dl/).
43+
* Go 1.23 or later, which you can download from [here](https://golang.org/dl/).
4444

4545
## Setup
4646

docs/quickstart.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ files into `/usr/local/bin`.
2828

2929
cd ~
3030

31-
# Install git, Go 1.21, make, curl
31+
# Install git, Go 1.23, make, curl
3232
sudo mkdir -p /etc/apt/sources.list.d
3333
echo "deb http://ftp.debian.org/debian bullseye-backports main" | \
3434
sudo tee /etc/apt/sources.list.d/bullseye-backports.list
3535
sudo DEBIAN_FRONTEND=noninteractive apt-get update
3636
sudo DEBIAN_FRONTEND=noninteractive apt-get \
3737
install --yes \
38-
golang-1.21 \
38+
golang-1.23 \
3939
make \
4040
git \
4141
curl \
@@ -44,8 +44,8 @@ sudo DEBIAN_FRONTEND=noninteractive apt-get \
4444
bc \
4545
gnupg
4646

47-
# Debian's Go 1.21 package installs "go" command under /usr/lib/go-1.21/bin
48-
export PATH=/usr/lib/go-1.21/bin:$PATH
47+
# Debian's Go 1.23 package installs "go" command under /usr/lib/go-1.23/bin
48+
export PATH=/usr/lib/go-1.23/bin:$PATH
4949

5050
cd ~
5151

@@ -93,7 +93,7 @@ sudo yum -y install \
9393
# need to source environment variables afterwards for the existing shell session.
9494
curl -LO https://get.golang.org/$(uname)/go_installer && \
9595
chmod +x go_installer && \
96-
./go_installer -version 1.21 && \
96+
./go_installer -version 1.23 && \
9797
rm go_installer && \
9898
source .bash_profile
9999

0 commit comments

Comments
 (0)