From 7fb51220c1576852cc855c5eb32f1f18a3e8a755 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 25 Jun 2017 01:55:07 +0800 Subject: [PATCH] refactor initial variable Signed-off-by: Bo-Yi Wu --- gorush/notification.go | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/gorush/notification.go b/gorush/notification.go index bfcf58c..021c0d1 100644 --- a/gorush/notification.go +++ b/gorush/notification.go @@ -393,16 +393,21 @@ func PushToIOS(req PushNotification) bool { if PushConf.Core.Sync { defer req.WaitDone() } - var retryCount = 0 - var maxRetry = PushConf.Ios.MaxRetry + + var ( + retryCount = 0 + maxRetry = PushConf.Ios.MaxRetry + ) if req.Retry > 0 && req.Retry < maxRetry { maxRetry = req.Retry } Retry: - var isError = false - var newTokens []string + var ( + isError = false + newTokens []string + ) notification := GetIOSNotification(req) @@ -506,9 +511,12 @@ func PushToAndroid(req PushNotification) bool { if PushConf.Core.Sync { defer req.WaitDone() } - var APIKey string - var retryCount = 0 - var maxRetry = PushConf.Android.MaxRetry + + var ( + APIKey string + retryCount = 0 + maxRetry = PushConf.Android.MaxRetry + ) if req.Retry > 0 && req.Retry < maxRetry { maxRetry = req.Retry