The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/3225

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
This branch drops an unnecessary else statement, as highlighted by a
linting hint in my emacs setup. Essentially since the "if" part ends
up with a return, there's no need for "else".

Signed-off-by: Free Ekanayaka <free.ekanay...@gmail.com>
From 1d9b18bf352234991db19b99c685b111b9d96a7a Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanay...@gmail.com>
Date: Wed, 26 Apr 2017 12:13:17 +0200
Subject: [PATCH] Drop unnecessary else statement

This branch drops an unnecessary else statement, as highlighted by a
linting hint in my emacs setup. Essentially since the "if" part ends
up with a return, there's no need for "else".

Signed-off-by: Free Ekanayaka <free.ekanay...@gmail.com>
---
 lxc/init.go | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/lxc/init.go b/lxc/init.go
index 85e8369..cf31812 100644
--- a/lxc/init.go
+++ b/lxc/init.go
@@ -228,21 +228,20 @@ func (c *initCmd) run(config *lxd.Config, args []string) 
error {
 
        if err != nil {
                return err
-       } else {
-               op, err := resp.MetadataAsOperation()
-               if err != nil {
-                       return fmt.Errorf(i18n.G("didn't get any affected 
image, container or snapshot from server"))
-               }
+       }
+       op, err := resp.MetadataAsOperation()
+       if err != nil {
+               return fmt.Errorf(i18n.G("didn't get any affected image, 
container or snapshot from server"))
+       }
 
-               containers, ok := op.Resources["containers"]
-               if !ok || len(containers) == 0 {
-                       return fmt.Errorf(i18n.G("didn't get any affected 
image, container or snapshot from server"))
-               }
+       containers, ok := op.Resources["containers"]
+       if !ok || len(containers) == 0 {
+               return fmt.Errorf(i18n.G("didn't get any affected image, 
container or snapshot from server"))
+       }
 
-               if len(containers) == 1 && name == "" {
-                       fields := strings.Split(containers[0], "/")
-                       fmt.Printf(i18n.G("Container name is: %s")+"\n", 
fields[len(fields)-1])
-               }
+       if len(containers) == 1 && name == "" {
+               fields := strings.Split(containers[0], "/")
+               fmt.Printf(i18n.G("Container name is: %s")+"\n", 
fields[len(fields)-1])
        }
 
        c.checkNetwork(d, name)
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to