cleanup: address gomnd warnings

Direct usage of numbers should be avoided.

Issue reported:
mnd: Magic number: X, in <argument> detected (gomnd)

Signed-off-by: Yug <yuggupta27@gmail.com>
This commit is contained in:
Yug
2020-07-21 10:40:13 +05:30
committed by mergify[bot]
parent e73fe64a0d
commit 71ddf51544
11 changed files with 38 additions and 22 deletions

View File

@ -62,9 +62,6 @@ const (
rbdImageRequiresEncryption = "requiresEncryption"
// image metadata key for encryption
encryptionMetaKey = ".rbd.csi.ceph.com/encrypted"
// go-ceph will provide rbd.ImageOptionCloneFormat
imageOptionCloneFormat = librbd.RbdImageOption(12)
)
// rbdVolume represents a CSI volume and its RBD image specifics.
@ -856,7 +853,7 @@ func (rv *rbdVolume) cloneRbdImageFromSnapshot(ctx context.Context, pSnapOpts *r
}
}
err = options.SetUint64(imageOptionCloneFormat, 2)
err = options.SetUint64(librbd.ImageOptionCloneFormat, 2)
if err != nil {
return fmt.Errorf("failed to set image features: %w", err)
}
@ -1006,7 +1003,8 @@ func (ri *rbdImageMetadataStash) String() string {
// JSON format.
func stashRBDImageMetadata(volOptions *rbdVolume, path string) error {
var imgMeta = rbdImageMetadataStash{
Version: 2, // there are no checks for this at present
// there are no checks for this at present
Version: 2, // nolint:gomnd // number specifies version.
Pool: volOptions.Pool,
ImageName: volOptions.RbdImageName,
Encrypted: volOptions.Encrypted,