From 81312a6647b3b9ad7d2c3d7c65831a9d1ef09d4b Mon Sep 17 00:00:00 2001 From: h3yEllex Date: Tue, 24 Oct 2017 13:02:55 +0300 Subject: [PATCH] Removed redunant else statement --- connect.go | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/connect.go b/connect.go index 1762f7fc..7ea0ac5a 100644 --- a/connect.go +++ b/connect.go @@ -422,24 +422,23 @@ func (c *Connection) runClient() error { if c.File.Hash != fileHash { return fmt.Errorf("\nUh oh! %s is corrupted! Sorry, try again.\n", c.File.Name) - } else { - if c.File.IsDir { // if the file was originally a dir - fmt.Print("decompressing folder") - log.Debug("untarring " + c.File.Name) - err := tarinator.UnTarinate(c.Path, path.Join(c.Path, c.File.Name)) + } + if c.File.IsDir { // if the file was originally a dir + fmt.Print("decompressing folder") + log.Debug("untarring " + c.File.Name) + err := tarinator.UnTarinate(c.Path, path.Join(c.Path, c.File.Name)) - if err != nil { - return err - } - // we remove the old tar.gz file - err = os.Remove(path.Join(c.Path, c.File.Name)) - if err != nil { - return err - } - fmt.Printf("\nReceived folder written to %s\n", path.Join(c.Path, c.File.Name[:len(c.File.Name)-4])) - } else { - fmt.Printf("\nReceived file written to %s\n", path.Join(c.Path, c.File.Name)) + if err != nil { + return err } + // we remove the old tar.gz file + err = os.Remove(path.Join(c.Path, c.File.Name)) + if err != nil { + return err + } + fmt.Printf("\nReceived folder written to %s\n", path.Join(c.Path, c.File.Name[:len(c.File.Name)-4])) + } else { + fmt.Printf("\nReceived file written to %s\n", path.Join(c.Path, c.File.Name)) } }