Skip unnecessary error check for simple regex compile in utils

pull/1175/head
Kai Lee 5 years ago
parent 4e35e7d749
commit 3db02c34f3
  1. 6
      internal/utils/utils.go

@ -71,11 +71,7 @@ func ConvertFixedDataIntoByteArray(data interface{}) []byte {
// GetUniqueIDFromIPPort -- // GetUniqueIDFromIPPort --
func GetUniqueIDFromIPPort(ip, port string) uint32 { func GetUniqueIDFromIPPort(ip, port string) uint32 {
reg, err := regexp.Compile("[^0-9]+") reg, _ := regexp.Compile("[^0-9]+")
if err != nil {
GetLogger().Crit("Regex Compilation Failed", "err", err)
panic(err)
}
socketID := reg.ReplaceAllString(ip+port, "") // A integer Id formed by unique IP/PORT pair socketID := reg.ReplaceAllString(ip+port, "") // A integer Id formed by unique IP/PORT pair
value, _ := strconv.Atoi(socketID) value, _ := strconv.Atoi(socketID)
return uint32(value) return uint32(value)

Loading…
Cancel
Save