From 3db02c34f306215fba833a1cbf5f843dc49174f2 Mon Sep 17 00:00:00 2001 From: Kai Lee Date: Thu, 27 Jun 2019 15:06:14 -0700 Subject: [PATCH] Skip unnecessary error check for simple regex compile in utils --- internal/utils/utils.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/internal/utils/utils.go b/internal/utils/utils.go index 1ec19e6dc..6fb670868 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -71,11 +71,7 @@ func ConvertFixedDataIntoByteArray(data interface{}) []byte { // GetUniqueIDFromIPPort -- func GetUniqueIDFromIPPort(ip, port string) uint32 { - reg, err := regexp.Compile("[^0-9]+") - if err != nil { - GetLogger().Crit("Regex Compilation Failed", "err", err) - panic(err) - } + reg, _ := regexp.Compile("[^0-9]+") socketID := reg.ReplaceAllString(ip+port, "") // A integer Id formed by unique IP/PORT pair value, _ := strconv.Atoi(socketID) return uint32(value)