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:
Alexander Andreev 2023-08-12 18:56:50 +04:00
parent 7c8baeecf5
commit d53622908b
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -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.