From e2e5530d3d18a2c47f8863255dbfe9ae651589b8 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 25 May 2023 10:20:40 -0700 Subject: [PATCH] ci: fix warnings, enable gosimple linter Signed-off-by: Kir Kolyshkin --- .golangci.yml | 1 - drivers/overlay/overlay.go | 2 +- pkg/devicemapper/devmapper.go | 8 +++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index c63af31a1c..df421c32df 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -6,5 +6,4 @@ run: linters: disable: - errcheck - - gosimple - staticcheck diff --git a/drivers/overlay/overlay.go b/drivers/overlay/overlay.go index e40a0e8b54..2ef74f86a6 100644 --- a/drivers/overlay/overlay.go +++ b/drivers/overlay/overlay.go @@ -181,7 +181,7 @@ func getMountProgramFlagFile(path string) string { } func checkSupportVolatile(home, runhome string) (bool, error) { - feature := fmt.Sprintf("volatile") + const feature = "volatile" volatileCacheResult, _, err := cachedFeatureCheck(runhome, feature) var usingVolatile bool if err == nil { diff --git a/pkg/devicemapper/devmapper.go b/pkg/devicemapper/devmapper.go index 6b9a7afcd2..b26e47d801 100644 --- a/pkg/devicemapper/devmapper.go +++ b/pkg/devicemapper/devmapper.go @@ -345,8 +345,7 @@ func RemoveDeviceDeferred(name string) error { // disable udev dm rules and delete the symlink under /dev/mapper by itself, // even if the removal is deferred by the kernel. cookie := new(uint) - var flags uint16 - flags = DmUdevDisableLibraryFallback + flags := uint16(DmUdevDisableLibraryFallback) if err := task.setCookie(cookie, flags); err != nil { return fmt.Errorf("devicemapper: Can not set cookie: %s", err) } @@ -384,7 +383,7 @@ func CancelDeferredRemove(deviceName string) error { return fmt.Errorf("devicemapper: Can't set sector %s", err) } - if err := task.setMessage(fmt.Sprintf("@cancel_deferred_remove")); err != nil { + if err := task.setMessage("@cancel_deferred_remove"); err != nil { return fmt.Errorf("devicemapper: Can't set message %s", err) } @@ -459,8 +458,7 @@ func CreatePool(poolName string, dataFile, metadataFile *os.File, poolBlockSize } cookie := new(uint) - var flags uint16 - flags = DmUdevDisableSubsystemRulesFlag | DmUdevDisableDiskRulesFlag | DmUdevDisableOtherRulesFlag + flags := uint16(DmUdevDisableSubsystemRulesFlag | DmUdevDisableDiskRulesFlag | DmUdevDisableOtherRulesFlag) if err := task.setCookie(cookie, flags); err != nil { return fmt.Errorf("devicemapper: Can't set cookie %s", err) }