소스 검색

lib: simplify code

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3119
Lars K.W. Gohlke 9 년 전
부모
커밋
22280db5db
2개의 변경된 파일2개의 추가작업 그리고 11개의 파일을 삭제
  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 {
 	if err != nil {
 		return err
 		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) {
 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)
 	body := fmt.Sprintf(tpl, s.URN, externalPort, protocol)
 
 
 	_, err := soapRequest(s.URL, s.URN, "DeletePortMapping", body)
 	_, 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.
 // GetExternalIPAddress queries the IGD service for its external IP address.