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

build: update Go 1.23 #5036

Open
wants to merge 6 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion api/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/ceph/ceph-csi/api

go 1.22.5
go 1.23.4

require (
github.com/ghodss/yaml v1.0.0
Expand Down
4 changes: 2 additions & 2 deletions build.env
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ BASE_IMAGE=quay.io/ceph/ceph:v19
CEPH_VERSION=squid

# standard Golang options
GOLANG_VERSION=1.22.5
GOLANG_VERSION=1.23.4
GO111MODULE=on

# commitlint version
COMMITLINT_VERSION=latest

# static checks and linters
GOLANGCI_VERSION=v1.57.2
GOLANGCI_VERSION=v1.62.2

# external snapshotter version
# Refer: https://github.com/kubernetes-csi/external-snapshotter/releases
Expand Down
8 changes: 4 additions & 4 deletions e2e/rbd_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
"k8s.io/kubernetes/test/e2e/framework"
)

//nolint:gomnd // numbers specify Kernel versions.
//nolint:mnd // numbers specify Kernel versions.
var nbdResizeSupport = []util.KernelVersion{
{
Version: 5,
Expand All @@ -48,7 +48,7 @@ var nbdResizeSupport = []util.KernelVersion{
}, // standard 5.3+ versions
}

//nolint:gomnd // numbers specify Kernel versions.
//nolint:mnd // numbers specify Kernel versions.
var fastDiffSupport = []util.KernelVersion{
{
Version: 5,
Expand All @@ -60,7 +60,7 @@ var fastDiffSupport = []util.KernelVersion{
}, // standard 5.3+ versions
}

//nolint:gomnd // numbers specify Kernel versions.
//nolint:mnd // numbers specify Kernel versions.
var deepFlattenSupport = []util.KernelVersion{
{
Version: 5,
Expand All @@ -75,7 +75,7 @@ var deepFlattenSupport = []util.KernelVersion{
// To use `io-timeout=0` we need
// www.mail-archive.com/[email protected]/msg38060.html
//
//nolint:gomnd // numbers specify Kernel versions.
//nolint:mnd // numbers specify Kernel versions.
var nbdZeroIOtimeoutSupport = []util.KernelVersion{
{
Version: 5,
Expand Down
6 changes: 3 additions & 3 deletions e2e/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -1580,10 +1580,10 @@ func k8sVersionGreaterEquals(c kubernetes.Interface, major, minor int) bool {
// return value.
}

maj := strconv.Itoa(major)
min := strconv.Itoa(minor)
_maj := strconv.Itoa(major)
Copy link
Member

Choose a reason for hiding this comment

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

This is rather ugly, not only because of the added _, also because comparing versions as a string.

Maybe it makes more sense to convert v.Major and v.Minor to integers?

_min := strconv.Itoa(minor)

return (v.Major > maj) || (v.Major == maj && v.Minor >= min)
return (v.Major > _maj) || (v.Major == _maj && v.Minor >= _min)
}

// waitForJobCompletion polls the status of the given job and waits until the
Expand Down
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/ceph/ceph-csi

go 1.22.7
go 1.23.4

require (
github.com/IBM/keyprotect-go-client v0.15.1
Expand Down
2 changes: 1 addition & 1 deletion internal/cephfs/mounter/volumemounter.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
var (
availableMounters []string

//nolint:gomnd // numbers specify Kernel versions.
//nolint:mnd // numbers specify Kernel versions.
quotaSupport = []util.KernelVersion{
{
Version: 4,
Expand Down
2 changes: 1 addition & 1 deletion internal/rbd/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ var (
kernelRelease = ""
// deepFlattenSupport holds the list of kernel which support mapping rbd
// image with deep-flatten image feature
//nolint:gomnd // numbers specify Kernel versions.
//nolint:mnd // numbers specify Kernel versions.
deepFlattenSupport = []util.KernelVersion{
{
Version: 5,
Expand Down
2 changes: 1 addition & 1 deletion internal/rbd/rbd_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,7 @@ func (ri *rbdImageMetadataStash) String() string {
func stashRBDImageMetadata(volOptions *rbdVolume, metaDataPath string) error {
imgMeta := rbdImageMetadataStash{
// there are no checks for this at present
Version: 3, //nolint:gomnd // number specifies version.
Version: 3, //nolint:mnd // number specifies version.
Pool: volOptions.Pool,
RadosNamespace: volOptions.RadosNamespace,
ImageName: volOptions.RbdImageName,
Expand Down
4 changes: 2 additions & 2 deletions internal/rbd/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ func (rv *rbdVolume) NewSnapshotByID(
log.DebugLog(ctx, "going to clone snapshot image %q from image %q with snapshot ID %d", snap, rv, id)

err = librbd.CloneImageByID(rv.ioctx, rv.RbdImageName, id, rv.ioctx, snap.RbdImageName, options)
if err != nil && !errors.Is(librbd.ErrExist, err) {
if err != nil && !errors.Is(err, librbd.ErrExist) {
log.ErrorLog(ctx, "failed to clone snapshot %q with id %d: %v", snap, id, err)

return nil, fmt.Errorf("failed to clone %q with snapshot id %d as new image %q: %w", rv.RbdImageName, id, snap, err)
Expand Down Expand Up @@ -342,7 +342,7 @@ func (rv *rbdVolume) NewSnapshotByID(
defer image.Close()

snapImage, err = image.CreateSnapshot(snap.RbdSnapName)
if err != nil && !errors.Is(librbd.ErrExist, err) {
if err != nil && !errors.Is(err, librbd.ErrExist) {
return nil, fmt.Errorf("failed to create snapshot on image %q: %w", snap, err)
}

Expand Down
8 changes: 8 additions & 0 deletions scripts/golangci.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ linters-settings:
- dupImport # https://github.com/go-critic/go-critic/issues/845
# TODO: uncheckedInlineErr gives many false-positives
- uncheckedInlineErr
gosec:
excludes:
# TODO: G115 gives many false-positives
- G115 # Potential integer overflow when converting between integer types
unused:
# treat code as a program (not a library) and report unused exported
# identifiers; default is false.
Expand Down Expand Up @@ -197,6 +201,7 @@ linters:
- wrapcheck
# TODO: enable linters added in golangci-lint 1.43
- contextcheck
- mnd
- gomnd
- ireturn
- tagliatelle
Expand All @@ -208,3 +213,6 @@ linters:
- containedctx
# TODO: depguard requires a list of (un)acceptable imports
- depguard
# TODO enable linters added in golangci-lint 1.60
- iface
- recvcheck
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ github.com/blang/semver/v4
## explicit; go 1.18
github.com/cenkalti/backoff/v4
# github.com/ceph/ceph-csi/api v0.0.0-00010101000000-000000000000 => ./api
## explicit; go 1.22.5
## explicit; go 1.23.4
github.com/ceph/ceph-csi/api/deploy/kubernetes
github.com/ceph/ceph-csi/api/deploy/kubernetes/cephfs
github.com/ceph/ceph-csi/api/deploy/kubernetes/nfs
Expand Down