[lxc-devel] [lxd/master] lxd: Fixes ineffectual assignment warnings
tomponline on Github
lxc-bot at linuxcontainers.org
Tue Oct 20 08:33:40 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 406 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201020/88215dc0/attachment.bin>
-------------- next part --------------
From ef2dfa8748815befa7f6705798c23d7445cb4691 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 20 Oct 2020 09:30:13 +0100
Subject: [PATCH 1/3] lxd/images: Fixes ineffectual assign warning
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/images.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lxd/images.go b/lxd/images.go
index 39c7df8d75..d97e759408 100644
--- a/lxd/images.go
+++ b/lxd/images.go
@@ -241,7 +241,7 @@ func imgPostInstanceInfo(d *Daemon, r *http.Request, req api.ImagesPost, op *ope
Tracker: &ioprogress.ProgressTracker{
Handler: func(value, speed int64) {
percent := int64(0)
- processed := int64(0)
+ var processed int64
if totalSize > 0 {
percent = value
From a4e89992943eb88dd8d1d1c010b332f626738170 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 20 Oct 2020 09:31:05 +0100
Subject: [PATCH 2/3] lxd/resources/usb: Fixes ineffectual assign warning
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/resources/usb.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lxd/resources/usb.go b/lxd/resources/usb.go
index 6479d252fc..fc88c459dc 100644
--- a/lxd/resources/usb.go
+++ b/lxd/resources/usb.go
@@ -186,7 +186,7 @@ func GetUSB() (*api.ResourcesUSB, error) {
return nil, errors.Wrapf(err, "Failed to parse class ID %q", content)
}
- ok := false
+ var ok bool
class, ok = usbid.Classes[usbid.ClassCode(iface.ClassID)]
if ok {
From 9aa5cfd3840415368d71064868391a570976c8fb Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 20 Oct 2020 09:32:13 +0100
Subject: [PATCH 3/3] lxd/storage/drivers/driver/lvm/volumes: Fixes ineffectual
assign warning
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/storage/drivers/driver_lvm_volumes.go | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/lxd/storage/drivers/driver_lvm_volumes.go b/lxd/storage/drivers/driver_lvm_volumes.go
index fbe1ef16da..e761fa2582 100644
--- a/lxd/storage/drivers/driver_lvm_volumes.go
+++ b/lxd/storage/drivers/driver_lvm_volumes.go
@@ -433,12 +433,9 @@ func (d *lvm) GetVolumeDiskPath(vol Volume) (string, error) {
// MountVolume mounts a volume. Returns true if this volume was our mount.
func (d *lvm) MountVolume(vol Volume, op *operations.Operation) (bool, error) {
- var err error
- activated := false
-
// Activate LVM volume if needed.
volDevPath := d.lvmDevPath(d.config["lvm.vg_name"], vol.volType, vol.contentType, vol.name)
- activated, err = d.activateVolume(volDevPath)
+ activated, err := d.activateVolume(volDevPath)
if err != nil {
return false, err
}
More information about the lxc-devel
mailing list