cloudfoundry/gorouter — pull request #61 by liuhewei (2014-10-10 10:44:01+00:00)
Title: Fix the error caused by the callback in loop

When we added more routes into `c.InfoRoutes`, we found all the callbacks set in `hs.HandleFunc` were using the same `marshaler` value of the last one in `c.InfoRoutes`. The reason is that the life scope of `marshaler` is the loop, so actually all the callbacks use the same one `marshaler`. This [link](http://tobyho.com/2011/11/02/callbacks-in-loops/) may explain it well even it's not golang (Javascript).

To fix this issue, we should put callbacks outside of the loop and then the correct `marshaler` value can be passed into it.