ci: update golangci-lint to v1.62.2

- gomnd is replaced by mnd in v1.58.0
- gosec exlcude G115 rule (Potential integer overflow when converting between integer types)
- disable new iface linter
- disable new recvcheck linter

Signed-off-by: Praveen M <m.praveen@ibm.com>
This commit is contained in:
Praveen M 2024-12-19 14:53:38 +05:30
parent 6acc44c4e6
commit 7d0b8580ea
6 changed files with 16 additions and 8 deletions

View File

@ -26,7 +26,7 @@ GO111MODULE=on
COMMITLINT_VERSION=latest COMMITLINT_VERSION=latest
# static checks and linters # static checks and linters
GOLANGCI_VERSION=v1.57.2 GOLANGCI_VERSION=v1.62.2
# external snapshotter version # external snapshotter version
# Refer: https://github.com/kubernetes-csi/external-snapshotter/releases # Refer: https://github.com/kubernetes-csi/external-snapshotter/releases

View File

@ -36,7 +36,7 @@ import (
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
) )
//nolint:gomnd // numbers specify Kernel versions. //nolint:mnd // numbers specify Kernel versions.
var nbdResizeSupport = []util.KernelVersion{ var nbdResizeSupport = []util.KernelVersion{
{ {
Version: 5, Version: 5,
@ -48,7 +48,7 @@ var nbdResizeSupport = []util.KernelVersion{
}, // standard 5.3+ versions }, // standard 5.3+ versions
} }
//nolint:gomnd // numbers specify Kernel versions. //nolint:mnd // numbers specify Kernel versions.
var fastDiffSupport = []util.KernelVersion{ var fastDiffSupport = []util.KernelVersion{
{ {
Version: 5, Version: 5,
@ -60,7 +60,7 @@ var fastDiffSupport = []util.KernelVersion{
}, // standard 5.3+ versions }, // standard 5.3+ versions
} }
//nolint:gomnd // numbers specify Kernel versions. //nolint:mnd // numbers specify Kernel versions.
var deepFlattenSupport = []util.KernelVersion{ var deepFlattenSupport = []util.KernelVersion{
{ {
Version: 5, Version: 5,
@ -75,7 +75,7 @@ var deepFlattenSupport = []util.KernelVersion{
// To use `io-timeout=0` we need // To use `io-timeout=0` we need
// www.mail-archive.com/linux-block@vger.kernel.org/msg38060.html // www.mail-archive.com/linux-block@vger.kernel.org/msg38060.html
// //
//nolint:gomnd // numbers specify Kernel versions. //nolint:mnd // numbers specify Kernel versions.
var nbdZeroIOtimeoutSupport = []util.KernelVersion{ var nbdZeroIOtimeoutSupport = []util.KernelVersion{
{ {
Version: 5, Version: 5,

View File

@ -31,7 +31,7 @@ import (
var ( var (
availableMounters []string availableMounters []string
//nolint:gomnd // numbers specify Kernel versions. //nolint:mnd // numbers specify Kernel versions.
quotaSupport = []util.KernelVersion{ quotaSupport = []util.KernelVersion{
{ {
Version: 4, Version: 4,

View File

@ -76,7 +76,7 @@ var (
kernelRelease = "" kernelRelease = ""
// deepFlattenSupport holds the list of kernel which support mapping rbd // deepFlattenSupport holds the list of kernel which support mapping rbd
// image with deep-flatten image feature // image with deep-flatten image feature
//nolint:gomnd // numbers specify Kernel versions. //nolint:mnd // numbers specify Kernel versions.
deepFlattenSupport = []util.KernelVersion{ deepFlattenSupport = []util.KernelVersion{
{ {
Version: 5, Version: 5,

View File

@ -1793,7 +1793,7 @@ func (ri *rbdImageMetadataStash) String() string {
func stashRBDImageMetadata(volOptions *rbdVolume, metaDataPath string) error { func stashRBDImageMetadata(volOptions *rbdVolume, metaDataPath string) error {
imgMeta := rbdImageMetadataStash{ imgMeta := rbdImageMetadataStash{
// there are no checks for this at present // 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, Pool: volOptions.Pool,
RadosNamespace: volOptions.RadosNamespace, RadosNamespace: volOptions.RadosNamespace,
ImageName: volOptions.RbdImageName, ImageName: volOptions.RbdImageName,

View File

@ -128,6 +128,10 @@ linters-settings:
- dupImport # https://github.com/go-critic/go-critic/issues/845 - dupImport # https://github.com/go-critic/go-critic/issues/845
# TODO: uncheckedInlineErr gives many false-positives # TODO: uncheckedInlineErr gives many false-positives
- uncheckedInlineErr - uncheckedInlineErr
gosec:
excludes:
# TODO: G115 gives many false-positives
- G115 # Potential integer overflow when converting between integer types
unused: unused:
# treat code as a program (not a library) and report unused exported # treat code as a program (not a library) and report unused exported
# identifiers; default is false. # identifiers; default is false.
@ -197,6 +201,7 @@ linters:
- wrapcheck - wrapcheck
# TODO: enable linters added in golangci-lint 1.43 # TODO: enable linters added in golangci-lint 1.43
- contextcheck - contextcheck
- mnd
- gomnd - gomnd
- ireturn - ireturn
- tagliatelle - tagliatelle
@ -208,3 +213,6 @@ linters:
- containedctx - containedctx
# TODO: depguard requires a list of (un)acceptable imports # TODO: depguard requires a list of (un)acceptable imports
- depguard - depguard
# TODO enable linters added in golangci-lint 1.60
- iface
- recvcheck