Browse Source

lib: simplify code

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3119
Lars K.W. Gohlke 9 years ago
parent
commit
22280db5db
2 changed files with 2 additions and 11 deletions
  1. 1 5
      lib/upgrade/upgrade_supported.go
  2. 1 6
      lib/upnp/igd_service.go

+ 1 - 5
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) {

+ 1 - 6
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.