3 ms·
Very cool. Reminiscent of express.js, but statically typed and in Go. I may look at this for future projects.
by semisight 13y ago
Very cool. Reminiscent of express.js, but statically typed and in Go. I may look at this for future projects.
- mmgutz 13y agoLooks like a lot of reflection. At that point, I would just stick with express and node. All that magic comes at a cost.
- elithrar 13y ago> Looks like a lot of reflection. At that point, I would just stick with express and node. All that magic comes at a cost. There's one use of reflection[1], and it's to ensure that the argument is a function. Reflection isn't inherently bad; using it at the drop of a hat is. [1]: https://github.com/codegangsta/martini/blob/master/martini.go#L102 https://github.com/codegangsta/martini/blob/master/martini.g... [edit]: Looks like I missed the `inject` import (thanks breakpete)
- breakpete 13y agoThere is more. The dependency injection implementation is based on reflection, using the https://github.com/codegangsta/inject https://github.com/codegangsta/inject package. See e.g https://github.com/codegangsta/martini/blob/master/martini.go#L136 https://github.com/codegangsta/martini/blob/master/martini.g... https://github.com/codegangsta/martini/blob/master/martini.go#L75 https://github.com/codegangsta/martini/blob/master/martini.g... Still, the end result is a nice API.