diff --git a/sql.go b/sql.go index 04127ff..7677347 100644 --- a/sql.go +++ b/sql.go @@ -279,7 +279,7 @@ func insertMsgReport(objId int64, war_date int32, atk int32, def int32, exp int3 return nil } -func loadMsgParsingRules() (map[int]MessageParsingRule, error) { +func loadMsgParsingRules() (m map[int]MessageParsingRule, err error) { var ( id int32 priority int32 @@ -289,13 +289,12 @@ func loadMsgParsingRules() (map[int]MessageParsingRule, error) { ) log.Println("Loading message parsing rules...") - m := make(map[int]MessageParsingRule) + m = make(map[int]MessageParsingRule) count := int(0) defer func() { if rec := recover(); rec != nil { - log.Printf("loadMsgParsingRules : panic %s \n", rec) - return + err := errors.New(rec) } }() @@ -316,10 +315,8 @@ func loadMsgParsingRules() (map[int]MessageParsingRule, error) { i.Description = descn i.Rule = rule i.MsgTypeID = msgTypeID - i.re = regexp.MustCompile(rule) m[count] = *i count++ - } return m, nil