2,348
社区成员




+func newRoute(method string, pattern string, handlers []Handler) route {
+ route := route{method, nil, handlers}
+ r := regexp.MustCompile(`:[^/#?()\.\\]+`)
+ pattern = r.ReplaceAllStringFunc(pattern, func(m string) string {
+ return fmt.Sprintf(`(?P<%s>[^/#?]+)`, m[1:len(m)])
+
+ })
+ pattern += `\/?`
+ route.regex = regexp.MustCompile(pattern)
+ return route
+}