Skip to content

Commit

Permalink
Merge 70bd037 into 7154d4c
Browse files Browse the repository at this point in the history
  • Loading branch information
xujiajun committed Nov 23, 2018
2 parents 7154d4c + 70bd037 commit 144340c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ func (router *Router) Generate(method string, routeName string, params map[strin
if string(segment[0]) == ":" {
key := params[string(segment[1:])]
re := regexp.MustCompile(defaultPattern)
one := re.Find([]byte(key))
if one == nil {
if one := re.Find([]byte(key)); one == nil {
return "", errGenerateParameters
}
segments = append(segments, key)
Expand All @@ -160,8 +159,7 @@ func (router *Router) Generate(method string, routeName string, params map[strin
splitRes := strings.Split(string(segment[1:segmentLen-1]), ":")
re := regexp.MustCompile(splitRes[1])
key := params[splitRes[0]]
one := re.Find([]byte(key))
if one == nil {
if one := re.Find([]byte(key)); one == nil {
return "", errGenerateParameters
}
segments = append(segments, key)
Expand Down

0 comments on commit 144340c

Please sign in to comment.