From 22280db5db7ad07a69dbbd1eed6d87d76bb4fa87 Mon Sep 17 00:00:00 2001 From: "Lars K.W. Gohlke" Date: Wed, 18 May 2016 22:47:11 +0000 Subject: [PATCH] lib: simplify code GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3119 --- lib/upgrade/upgrade_supported.go | 6 +----- lib/upnp/igd_service.go | 7 +------ 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/upgrade/upgrade_supported.go b/lib/upgrade/upgrade_supported.go index 316461d11..d1ccabcfe 100644 --- a/lib/upgrade/upgrade_supported.go +++ b/lib/upgrade/upgrade_supported.go @@ -180,11 +180,7 @@ func upgradeToURL(archiveName, binary string, url string) error { if err != nil { return err } - err = os.Rename(fname, binary) - if err != nil { - return err - } - return nil + return os.Rename(fname, binary) } func readRelease(archiveName, dir, url string) (string, error) { diff --git a/lib/upnp/igd_service.go b/lib/upnp/igd_service.go index bfb12359a..4008f5ea3 100644 --- a/lib/upnp/igd_service.go +++ b/lib/upnp/igd_service.go @@ -87,12 +87,7 @@ func (s *IGDService) DeletePortMapping(protocol nat.Protocol, externalPort int) body := fmt.Sprintf(tpl, s.URN, externalPort, protocol) _, err := soapRequest(s.URL, s.URN, "DeletePortMapping", body) - - if err != nil { - return err - } - - return nil + return err } // GetExternalIPAddress queries the IGD service for its external IP address.