Shortened a Router.Handler() method by removing if statement in the end, here just returning a result of add() func is sufficient.
This commit is contained in:
parent
7c8baeecf5
commit
d53622908b
6
httpr.go
6
httpr.go
@ -193,11 +193,7 @@ func (rr *Router) Handler(method, pattern string, handler http.HandlerFunc) erro
|
||||
rr.tree[method] = &node{endpoint: "/"}
|
||||
}
|
||||
|
||||
if err := rr.tree[method].add(path, handler); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return rr.tree[method].add(path, handler)
|
||||
}
|
||||
|
||||
// ServeStatic serves a given file system.
|
||||
|
Loading…
Reference in New Issue
Block a user