refactored
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
// WildcardMXIDsToRegexes converts a list of wildcard patterns to a list of regular expressions
|
||||
func WildcardMXIDsToRegexes(wildCardPatterns []string) (*[]*regexp.Regexp, error) {
|
||||
func WildcardMXIDsToRegexes(wildCardPatterns []string) ([]*regexp.Regexp, error) {
|
||||
regexPatterns := make([]*regexp.Regexp, len(wildCardPatterns))
|
||||
|
||||
for idx, wildCardPattern := range wildCardPatterns {
|
||||
@@ -18,7 +18,7 @@ func WildcardMXIDsToRegexes(wildCardPatterns []string) (*[]*regexp.Regexp, error
|
||||
regexPatterns[idx] = regex
|
||||
}
|
||||
|
||||
return ®exPatterns, nil
|
||||
return regexPatterns, nil
|
||||
}
|
||||
|
||||
// Match tells if the given user id is allowed to use the bot, according to the given whitelist
|
||||
|
||||
@@ -202,7 +202,7 @@ func TestMatch(t *testing.T) {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
actualResult := Match(testData.checkedValue, *allowedUserRegexes)
|
||||
actualResult := Match(testData.checkedValue, allowedUserRegexes)
|
||||
|
||||
if actualResult == testData.expectedResult {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user