From d53622908bd8fd1d12e4606e3ec6e778333659c2 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sat, 12 Aug 2023 18:56:50 +0400 Subject: [PATCH] Shortened a Router.Handler() method by removing if statement in the end, here just returning a result of add() func is sufficient. --- httpr.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/httpr.go b/httpr.go index a14b6ed..2a4d2bf 100644 --- a/httpr.go +++ b/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.