File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ func (r *Mux) Autocomplete(pattern string, h AutocompleteHandler) {
166
166
167
167
// Component registers the given ComponentHandler to the current Router.
168
168
func (r * Mux ) Component (pattern string , h ComponentHandler ) {
169
- checkPatternEmpty (pattern )
169
+ checkPattern (pattern )
170
170
r .handle (& handlerHolder [ComponentHandler ]{
171
171
pattern : pattern ,
172
172
handler : h ,
@@ -176,7 +176,7 @@ func (r *Mux) Component(pattern string, h ComponentHandler) {
176
176
177
177
// Modal registers the given ModalHandler to the current Router.
178
178
func (r * Mux ) Modal (pattern string , h ModalHandler ) {
179
- checkPatternEmpty (pattern )
179
+ checkPattern (pattern )
180
180
r .handle (& handlerHolder [ModalHandler ]{
181
181
pattern : pattern ,
182
182
handler : h ,
@@ -190,14 +190,10 @@ func (r *Mux) NotFound(h NotFoundHandler) {
190
190
r .notFoundHandler = h
191
191
}
192
192
193
- func checkPatternEmpty (pattern string ) {
194
- if pattern == "" {
193
+ func checkPattern (pattern string ) {
194
+ if len ( pattern ) == 0 {
195
195
panic ("pattern must not be empty" )
196
196
}
197
- }
198
-
199
- func checkPattern (pattern string ) {
200
- checkPatternEmpty (pattern )
201
197
if pattern [0 ] != '/' {
202
198
panic ("pattern must start with /" )
203
199
}
You can’t perform that action at this time.
0 commit comments