diff --git a/e2e/cephfs.go b/e2e/cephfs.go index 5161a496a..43ca46ba2 100644 --- a/e2e/cephfs.go +++ b/e2e/cephfs.go @@ -23,7 +23,7 @@ import ( "sync" snapapi "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1" - . "github.com/onsi/ginkgo/v2" // nolint + . "github.com/onsi/ginkgo/v2" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" clientset "k8s.io/client-go/kubernetes" diff --git a/e2e/deploy-vault.go b/e2e/deploy-vault.go index 799b0f775..1ee7d626e 100644 --- a/e2e/deploy-vault.go +++ b/e2e/deploy-vault.go @@ -21,7 +21,7 @@ import ( "fmt" "strings" - . "github.com/onsi/gomega" // nolint + . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/kubernetes/test/e2e/framework" diff --git a/e2e/errors_test.go b/e2e/errors_test.go index 6ee54217d..5f226822a 100644 --- a/e2e/errors_test.go +++ b/e2e/errors_test.go @@ -21,7 +21,7 @@ import ( "testing" ) -// nolint:lll // error string cannot be split into multiple lines as is a +//nolint:lll // error string cannot be split into multiple lines as is a // output from kubectl. func TestGetStdErr(t *testing.T) { t.Parallel() diff --git a/e2e/migration.go b/e2e/migration.go index 169a7602a..6802d981f 100644 --- a/e2e/migration.go +++ b/e2e/migration.go @@ -30,7 +30,7 @@ import ( // composeIntreeMigVolID create a volID similar to intree migration volID // the migration volID format looks like below // mig-mons--image- -// nolint:lll // ex: "mig_mons-b7f67366bb43f32e07d8a261a7840da9_image-e0b45b52-7e09-47d3-8f1b-806995fa4412_706f6f6c5f7265706c6963615f706f6f6c +//nolint:lll // ex: "mig_mons-b7f67366bb43f32e07d8a261a7840da9_image-e0b45b52-7e09-47d3-8f1b-806995fa4412_706f6f6c5f7265706c6963615f706f6f6c func composeIntreeMigVolID(mons, rbdImageName string) string { poolField := hex.EncodeToString([]byte(defaultRBDPool)) monsField := monsPrefix + getMonsHash(mons) diff --git a/e2e/nfs.go b/e2e/nfs.go index c900d5638..17fdea90c 100644 --- a/e2e/nfs.go +++ b/e2e/nfs.go @@ -24,7 +24,7 @@ import ( "time" snapapi "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1" - . "github.com/onsi/ginkgo/v2" // nolint + . "github.com/onsi/ginkgo/v2" v1 "k8s.io/api/core/v1" apierrs "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/e2e/pod.go b/e2e/pod.go index 236629893..d02e05c89 100644 --- a/e2e/pod.go +++ b/e2e/pod.go @@ -420,7 +420,7 @@ func deletePod(name, ns string, c kubernetes.Interface, t int) error { }) } -// nolint:unparam // currently skipNotFound is always false, this can change in the future +//nolint:unparam // currently skipNotFound is always false, this can change in the future func deletePodWithLabel(label, ns string, skipNotFound bool) error { err := retryKubectlArgs( ns, diff --git a/e2e/rbd.go b/e2e/rbd.go index 49620dfd0..6b9648bfa 100644 --- a/e2e/rbd.go +++ b/e2e/rbd.go @@ -25,7 +25,7 @@ import ( "github.com/ceph/ceph-csi/internal/util" - . "github.com/onsi/ginkgo/v2" // nolint + . "github.com/onsi/ginkgo/v2" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -204,7 +204,7 @@ func checkGetKeyError(err error, stdErr string) bool { } // checkClusternameInMetadata check for cluster name metadata on RBD image. -// nolint:nilerr // intentionally returning nil on error in the retry loop. +//nolint:nilerr // intentionally returning nil on error in the retry loop. func checkClusternameInMetadata(f *framework.Framework, ns, pool, image string) { t := time.Duration(deployTimeout) * time.Minute var ( diff --git a/e2e/rbd_helper.go b/e2e/rbd_helper.go index 45a25df28..c8175cf75 100644 --- a/e2e/rbd_helper.go +++ b/e2e/rbd_helper.go @@ -37,7 +37,7 @@ import ( "k8s.io/kubernetes/test/e2e/framework" ) -// nolint:gomnd // numbers specify Kernel versions. +//nolint:gomnd // numbers specify Kernel versions. var nbdResizeSupport = []util.KernelVersion{ { Version: 5, @@ -49,7 +49,7 @@ var nbdResizeSupport = []util.KernelVersion{ }, // standard 5.3+ versions } -// nolint:gomnd // numbers specify Kernel versions. +//nolint:gomnd // numbers specify Kernel versions. var fastDiffSupport = []util.KernelVersion{ { Version: 5, @@ -61,7 +61,7 @@ var fastDiffSupport = []util.KernelVersion{ }, // standard 5.3+ versions } -// nolint:gomnd // numbers specify Kernel versions. +//nolint:gomnd // numbers specify Kernel versions. var deepFlattenSupport = []util.KernelVersion{ { Version: 5, @@ -75,7 +75,7 @@ var deepFlattenSupport = []util.KernelVersion{ // To use `io-timeout=0` we need // www.mail-archive.com/linux-block@vger.kernel.org/msg38060.html -// nolint:gomnd // numbers specify Kernel versions. +//nolint:gomnd // numbers specify Kernel versions. var nbdZeroIOtimeoutSupport = []util.KernelVersion{ { Version: 5, diff --git a/e2e/resize.go b/e2e/resize.go index 29d54f79f..10347b650 100644 --- a/e2e/resize.go +++ b/e2e/resize.go @@ -22,7 +22,7 @@ import ( "strings" "time" - . "github.com/onsi/gomega" // nolint + . "github.com/onsi/gomega" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/e2e/snapshot.go b/e2e/snapshot.go index 8c29876fc..8b0a7adb8 100644 --- a/e2e/snapshot.go +++ b/e2e/snapshot.go @@ -23,7 +23,7 @@ import ( snapapi "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1" snapclient "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1" - . "github.com/onsi/gomega" // nolint + . "github.com/onsi/gomega" v1 "k8s.io/api/core/v1" apierrs "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/resource" @@ -293,7 +293,7 @@ func getVolumeSnapshotContent(namespace, snapshotName string) (*snapapi.VolumeSn return volumeSnapshotContent, nil } -// nolint:gocyclo,cyclop // reduce complexity +//nolint:gocyclo,cyclop // reduce complexity func validateBiggerPVCFromSnapshot(f *framework.Framework, pvcPath, appPath, diff --git a/e2e/staticpvc.go b/e2e/staticpvc.go index 57771c8ec..1bb60f5fe 100644 --- a/e2e/staticpvc.go +++ b/e2e/staticpvc.go @@ -322,7 +322,7 @@ func validateRBDStaticMigrationPVC(f *framework.Framework, appPath, scName strin return err } -// nolint:gocyclo,cyclop // reduce complexity +//nolint:gocyclo,cyclop // reduce complexity func validateCephFsStaticPV(f *framework.Framework, appPath, scPath string) error { opt := make(map[string]string) var ( diff --git a/e2e/upgrade-cephfs.go b/e2e/upgrade-cephfs.go index 98c3d3b3a..7a8c5e1e8 100644 --- a/e2e/upgrade-cephfs.go +++ b/e2e/upgrade-cephfs.go @@ -23,7 +23,7 @@ import ( "path/filepath" "strings" - . "github.com/onsi/ginkgo/v2" // nolint + . "github.com/onsi/ginkgo/v2" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/e2e/upgrade-rbd.go b/e2e/upgrade-rbd.go index 24f2016e2..1c3264071 100644 --- a/e2e/upgrade-rbd.go +++ b/e2e/upgrade-rbd.go @@ -23,7 +23,7 @@ import ( "path/filepath" "strings" - . "github.com/onsi/ginkgo/v2" // nolint + . "github.com/onsi/ginkgo/v2" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/e2e/utils.go b/e2e/utils.go index 7eaea6d0a..2e2798aca 100644 --- a/e2e/utils.go +++ b/e2e/utils.go @@ -852,7 +852,7 @@ func writeDataAndCalChecksum(app *v1.Pod, opt *metav1.ListOptions, f *framework. return checkSum, nil } -// nolint:gocyclo,gocognit,nestif,cyclop // reduce complexity +//nolint:gocyclo,gocognit,nestif,cyclop // reduce complexity func validatePVCClone( totalCount int, sourcePvcPath, sourceAppPath, clonePvcPath, clonePvcAppPath, @@ -1067,7 +1067,7 @@ func validatePVCClone( validateRBDImageCount(f, 0, defaultRBDPool) } -// nolint:gocyclo,gocognit,nestif,cyclop // reduce complexity +//nolint:gocyclo,gocognit,nestif,cyclop // reduce complexity func validatePVCSnapshot( totalCount int, pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath string, @@ -1529,7 +1529,7 @@ func validateController( return deleteResource(rbdExamplePath + "storageclass.yaml") } -// nolint:deadcode,unused // Unused code will be used in future. +//nolint:deadcode,unused // Unused code will be used in future. // k8sVersionGreaterEquals checks the ServerVersion of the Kubernetes cluster // and compares it to the major.minor version passed. In case the version of // the cluster is equal or higher to major.minor, `true` is returned, `false` @@ -1681,7 +1681,7 @@ func retryKubectlFile(namespace string, action kubectlAction, filename string, t // retryKubectlArgs takes a namespace and action telling kubectl what to do // with the passed arguments. This function retries until no error occurred, or // the timeout passed. -// nolint:unparam // retryKubectlArgs will be used with kubectlDelete arg later on. +//nolint:unparam // retryKubectlArgs will be used with kubectlDelete arg later on. func retryKubectlArgs(namespace string, action kubectlAction, t int, args ...string) error { timeout := time.Duration(t) * time.Minute args = append([]string{string(action)}, args...) diff --git a/internal/cephfs/controllerserver.go b/internal/cephfs/controllerserver.go index 966416908..80b24273e 100644 --- a/internal/cephfs/controllerserver.go +++ b/internal/cephfs/controllerserver.go @@ -241,7 +241,7 @@ func checkValidCreateVolumeRequest( } // CreateVolume creates a reservation and the volume in backend, if it is not already present. -// nolint:gocognit,gocyclo,nestif,cyclop // TODO: reduce complexity +//nolint:gocognit,gocyclo,nestif,cyclop // TODO: reduce complexity func (cs *ControllerServer) CreateVolume( ctx context.Context, req *csi.CreateVolumeRequest, @@ -730,7 +730,7 @@ func (cs *ControllerServer) ControllerExpandVolume( // CreateSnapshot creates the snapshot in backend and stores metadata // in store -// nolint:gocognit,gocyclo,cyclop // golangci-lint did not catch this earlier, needs to get fixed late +//nolint:gocognit,gocyclo,cyclop // golangci-lint did not catch this earlier, needs to get fixed late func (cs *ControllerServer) CreateSnapshot( ctx context.Context, req *csi.CreateSnapshotRequest, @@ -986,7 +986,7 @@ func (cs *ControllerServer) validateSnapshotReq(ctx context.Context, req *csi.Cr // DeleteSnapshot deletes the snapshot in backend and removes the // snapshot metadata from store. -// nolint:gocyclo,cyclop // TODO: reduce complexity +//nolint:gocyclo,cyclop // TODO: reduce complexity func (cs *ControllerServer) DeleteSnapshot( ctx context.Context, req *csi.DeleteSnapshotRequest, diff --git a/internal/cephfs/mounter/volumemounter.go b/internal/cephfs/mounter/volumemounter.go index e740f4f13..dcfccb177 100644 --- a/internal/cephfs/mounter/volumemounter.go +++ b/internal/cephfs/mounter/volumemounter.go @@ -31,7 +31,7 @@ import ( var ( availableMounters []string - // nolint:gomnd // numbers specify Kernel versions. + //nolint:gomnd // numbers specify Kernel versions. quotaSupport = []util.KernelVersion{ { Version: 4, diff --git a/internal/cephfs/store/fsjournal.go b/internal/cephfs/store/fsjournal.go index b0a3bb5b1..e9505b7ad 100644 --- a/internal/cephfs/store/fsjournal.go +++ b/internal/cephfs/store/fsjournal.go @@ -71,7 +71,7 @@ because, the order of omap creation and deletion are inverse of each other, and request name lock, and hence any stale omaps are leftovers from incomplete transactions and are hence safe to garbage collect. */ -// nolint:gocognit,gocyclo,nestif,cyclop // TODO: reduce complexity +//nolint:gocognit,gocyclo,nestif,cyclop // TODO: reduce complexity func CheckVolExists(ctx context.Context, volOptions, parentVolOpt *VolumeOptions, diff --git a/internal/cephfs/store/volumeoptions.go b/internal/cephfs/store/volumeoptions.go index 8ff10cbf5..db63a90ea 100644 --- a/internal/cephfs/store/volumeoptions.go +++ b/internal/cephfs/store/volumeoptions.go @@ -210,7 +210,7 @@ func fmtBackingSnapshotOptionMismatch(optName, expected, actual string) error { // NewVolumeOptions generates a new instance of volumeOptions from the provided // CSI request parameters. -// nolint:gocyclo,cyclop // TODO: reduce complexity +//nolint:gocyclo,cyclop // TODO: reduce complexity func NewVolumeOptions( ctx context.Context, requestName, @@ -348,7 +348,7 @@ func IsVolumeCreateRO(caps []*csi.VolumeCapability) bool { // newVolumeOptionsFromVolID generates a new instance of volumeOptions and VolumeIdentifier // from the provided CSI VolumeID. -// nolint:gocyclo,cyclop // TODO: reduce complexity +//nolint:gocyclo,cyclop // TODO: reduce complexity func NewVolumeOptionsFromVolID( ctx context.Context, volID string, diff --git a/internal/csi-common/driver.go b/internal/csi-common/driver.go index ee2b42434..9c6139b34 100644 --- a/internal/csi-common/driver.go +++ b/internal/csi-common/driver.go @@ -82,7 +82,7 @@ func (d *CSIDriver) ValidateControllerServiceRequest(c csi.ControllerServiceCapa } } - return status.Error(codes.InvalidArgument, fmt.Sprintf("%s", c)) //nolint + return status.Error(codes.InvalidArgument, fmt.Sprintf("%s", c)) } // AddControllerServiceCapabilities stores the controller capabilities diff --git a/internal/kms/secretskms_test.go b/internal/kms/secretskms_test.go index e8a9c326f..835d00db4 100644 --- a/internal/kms/secretskms_test.go +++ b/internal/kms/secretskms_test.go @@ -53,7 +53,7 @@ func TestGenerateNonce(t *testing.T) { func TestGenerateCipher(t *testing.T) { t.Parallel() - // nolint:gosec // this passphrase is intentionally hardcoded + //nolint:gosec // this passphrase is intentionally hardcoded passphrase := "my-cool-luks-passphrase" salt := "unique-id-for-the-volume" diff --git a/internal/kms/vault.go b/internal/kms/vault.go index f1b42a396..c181f37ac 100644 --- a/internal/kms/vault.go +++ b/internal/kms/vault.go @@ -123,7 +123,7 @@ func setConfigString(option *string, config map[string]interface{}, key string) // these settings will be used when connecting to the Vault service with // vc.connectVault(). // -// nolint:gocyclo,cyclop // iterating through many config options, not complex at all. +//nolint:gocyclo,cyclop // iterating through many config options, not complex at all. func (vc *vaultConnection) initConnection(config map[string]interface{}) error { vaultConfig := make(map[string]interface{}) keyContext := make(map[string]string) diff --git a/internal/kms/vault_tokens.go b/internal/kms/vault_tokens.go index 5c7c96e90..eea2cf4b0 100644 --- a/internal/kms/vault_tokens.go +++ b/internal/kms/vault_tokens.go @@ -353,7 +353,7 @@ func (kms *vaultTokensKMS) setTokenName(config map[string]interface{}) error { // initCertificates updates the kms.vaultConfig with the options from config // it calls the kubernetes secrets and get the required data. -// nolint:gocyclo,cyclop // iterating through many config options, not complex at all. +//nolint:gocyclo,cyclop // iterating through many config options, not complex at all. func (vtc *vaultTenantConnection) initCertificates(config map[string]interface{}) error { vaultConfig := make(map[string]interface{}) diff --git a/internal/rbd/controllerserver.go b/internal/rbd/controllerserver.go index 452e0266f..3bbf952ed 100644 --- a/internal/rbd/controllerserver.go +++ b/internal/rbd/controllerserver.go @@ -1060,7 +1060,7 @@ func (cs *ControllerServer) ValidateVolumeCapabilities( } // CreateSnapshot creates the snapshot in backend and stores metadata in store. -// nolint:gocyclo,cyclop // TODO: reduce complexity. +//nolint:gocyclo,cyclop // TODO: reduce complexity. func (cs *ControllerServer) CreateSnapshot( ctx context.Context, req *csi.CreateSnapshotRequest, diff --git a/internal/rbd/nodeserver.go b/internal/rbd/nodeserver.go index fa771b995..7798acf72 100644 --- a/internal/rbd/nodeserver.go +++ b/internal/rbd/nodeserver.go @@ -78,7 +78,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:gomnd // numbers specify Kernel versions. deepFlattenSupport = []util.KernelVersion{ { Version: 5, @@ -114,7 +114,7 @@ var ( // parseBoolOption checks if parameters contain option and parse it. If it is // empty or not set return default. -// nolint:unparam // currently defValue is always false, this can change in the future +//nolint:unparam // currently defValue is always false, this can change in the future func parseBoolOption(ctx context.Context, parameters map[string]string, optionName string, defValue bool) bool { boolVal := defValue diff --git a/internal/rbd/rbd_journal.go b/internal/rbd/rbd_journal.go index f1a2da95b..c9681060a 100644 --- a/internal/rbd/rbd_journal.go +++ b/internal/rbd/rbd_journal.go @@ -538,7 +538,7 @@ func undoVolReservation(ctx context.Context, rbdVol *rbdVolume, cr *util.Credent // Generate new volume Handler // The volume handler won't remain same as its contains poolID,clusterID etc // which are not same across clusters. -// nolint:gocyclo,cyclop,nestif // TODO: reduce complexity +//nolint:gocyclo,cyclop,nestif // TODO: reduce complexity func RegenerateJournal( volumeAttributes map[string]string, claimName, diff --git a/internal/rbd/rbd_util.go b/internal/rbd/rbd_util.go index b3df8ad77..2339f80e0 100644 --- a/internal/rbd/rbd_util.go +++ b/internal/rbd/rbd_util.go @@ -1161,7 +1161,7 @@ func generateVolumeFromVolumeID( // GenVolFromVolID generates a rbdVolume structure from the provided identifier, updating // the structure with elements from on-disk image metadata as well. // -// nolint // returns non-exported *rbdVolume, which is fine + func GenVolFromVolID( ctx context.Context, volumeID string, @@ -1702,7 +1702,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:gomnd // number specifies version. Pool: volOptions.Pool, RadosNamespace: volOptions.RadosNamespace, ImageName: volOptions.RbdImageName, diff --git a/internal/util/conn_pool_test.go b/internal/util/conn_pool_test.go index 6fe3f094b..27079ec21 100644 --- a/internal/util/conn_pool_test.go +++ b/internal/util/conn_pool_test.go @@ -73,7 +73,7 @@ func (cp *ConnPool) fakeGet(monitors, user, keyfile string) (*rados.Conn, string return conn, unique, nil } -// nolint:paralleltest // these tests cannot run in parallel +//nolint:paralleltest // these tests cannot run in parallel func TestConnPool(t *testing.T) { cp := NewConnPool(interval, expiry) defer cp.Destroy() diff --git a/internal/util/csiconfig.go b/internal/util/csiconfig.go index c6ec96305..48a2e09c1 100644 --- a/internal/util/csiconfig.go +++ b/internal/util/csiconfig.go @@ -67,7 +67,7 @@ type ClusterInfo struct { } // Expected JSON structure in the passed in config file is, -// nolint:godot // example json content should not contain unwanted dot. +//nolint:godot // example json content should not contain unwanted dot. /* [{ "clusterID": "", diff --git a/internal/util/reftracker/errors/errors.go b/internal/util/reftracker/errors/errors.go index 33f1a2740..e0dbb3b98 100644 --- a/internal/util/reftracker/errors/errors.go +++ b/internal/util/reftracker/errors/errors.go @@ -70,7 +70,7 @@ func TryRADOSAborted(opErr error) error { return opErr } - // nolint:errorlint // Can't use errors.As() because rados.radosError is private. + //nolint:errorlint // Can't use errors.As() because rados.radosError is private. errnoErr, ok := radosOpErr.OpError.(interface{ ErrorCode() int }) if !ok { return opErr diff --git a/internal/util/reftracker/reftype/reftype.go b/internal/util/reftracker/reftype/reftype.go index e2d6d1587..9a8890af2 100644 --- a/internal/util/reftracker/reftype/reftype.go +++ b/internal/util/reftracker/reftype/reftype.go @@ -54,7 +54,7 @@ func FromBytes(bs []byte) (RefType, error) { } num := RefType(bs[0]) - switch num { // nolint:exhaustive // reftype.Unknown is handled in default case. + switch num { //nolint:exhaustive // reftype.Unknown is handled in default case. case Normal, Mask: return num, nil default: