title: Golang httpRouter returns the last response when used with the slice of functions
body: <p>I am trying to implement <code>expressjs</code> like features to <code>httprouter</code> package .
  I create a struct <code>type mounter</code></p>
  
  <pre><code>type Mounter struct {
      BasePath string
      Routes   []*Route
  }
  </code></pre>
  
  <p>and a <code>Route</code> struct which represents subRoutes </p>
  
  <pre><code>type Route struct {
      Path   string
      Method string
      Func   Handle
  }
  </code></pre>
  
  <p><code>type Handle func(http.ResponseWriter, *http.Request, Params)</code></p>
  
  <p><code>type Params interface{}</code></p>
  
  <p>i have a <code>NewRoutes</code> Function which is the main thing i wanted to port from expressjs new routes does the same thing as <code>express.Router</code></p>
  
  <pre><code>func NewRoutes(base string) (mounter *Mounter) {
      mounter = &amp;Mounter{
          BasePath: base,
      }
      return
  }
  </code></pre>
  
  <p>and i have <code>get post put delete</code> methods under <code>*Mounter</code></p>
  
  <pre><code>//GET request handler
  func (mounter *Mounter) GET(path string, Func Handle) {
      mounter.Routes = append(mounter.Routes, &amp;Route{path, "get", Func})
  }
  
  //POST request handler
  func (mounter *Mounter) POST(path string, Func Handle) {
      mounter.Routes = append(mounter.Routes, &amp;Route{path, "post", Func})
  }
  
  //PUT request handler
  func (mounter *Mounter) PUT(path string, Func Handle) {
      mounter.Routes = append(mounter.Routes, &amp;Route{path, "put", Func})
  }
  
  //DELETE request handler
  func (mounter *Mounter) DELETE(path string, Func Handle) {
      mounter.Routes = append(mounter.Routes, &amp;Route{path, "delete", Func})
  }
  </code></pre>
  
  <p>and finally i have a Mount method which mounts the router to the actual router</p>
  
  <pre><code>func (mounter *Mounter) Mount(router *rtr.Router) {
      mounter.BasePath = strings.TrimSuffix(mounter.BasePath, "/")
      for _, route := range mounter.Routes {
          path := route.Path
          if !strings.HasSuffix(path, "/") {
              path += "/"
          }
          path = mounter.BasePath + path
          switch strings.ToLower(route.Method) {
          case "get":
              router.GET(path, func(res http.ResponseWriter, req *http.Request, params rtr.Params) {
                  route.Func(res, req, params)
              })
          case "post":
              router.POST(path, func(res http.ResponseWriter, req *http.Request, params rtr.Params) {
                  route.Func(res, req, params)
              })
          case "delete":
              router.DELETE(path, func(res http.ResponseWriter, req *http.Request, params rtr.Params) {
                  route.Func(res, req, params)
              })
          case "put":
              router.PUT(path, func(res http.ResponseWriter, req *http.Request, params rtr.Params) {
                  route.Func(res, req, params)
              })
          }
      }
  }
  </code></pre>
  
  <p>everything works pretty nice and the methods are working fine too if i try to send a post request to a get endpoint it gives a nice 404 but the only issue is it always responds with the handler of last added member regardless of subpath so </p>
  
  <pre><code>package api
  var ApiRouter = express.NewRoutes("/api/")
  
  func init() {
      ApiRouter.GET("/", func(res http.ResponseWriter, req *http.Request, _ express.Params) {
          fmt.Fprintln(res, "testget/")
      })
      ApiRouter.GET("/pt", func(res http.ResponseWriter, req *http.Request, _ express.Params) {
          fmt.Fprintln(res, "pt")
      })
      ApiRouter.POST("/test", func(res http.ResponseWriter, req *http.Request, _ express.Params) {
          fmt.Fprintln(res, "test/post")
      })
  }
  
  package main
  func main() {
      router := express.New()
      api.ApiRouter.Mount(router)
      for _, route := range api.ApiRouter.Routes {
          fmt.Println(*route)
      }
      router.ServeFiles("/public/*filepath", http.Dir("./public/"))
      http.ListenAndServe(":1024", router)
  }
  </code></pre>
  
  <p>Will always respond <code>test/post</code> and the output of the <code>range</code> i am doing above for test purposes is 
  <img src="https://i.imgur.com/pNuG2Gn.png" alt="">
  So do you have any idea why it uses always the same function to respond but recognizes paths perfectly?</p>