Ask HN: Which Go Web Framework (Pros and Cons)?
Beego is a "batteries included" Framework, it seems very similar to Django (Python), on the other side Gorilla is more a set of components that can be used together, Gorilla feels more like a microframework Flask-like (Python).
I would love if we can talk about our experience with Web Framework.
Which Framework are you using? How you compare it to your former web framework? What are the Pros/Cons?
Here a short list of the popular Go Web Frameworks:
- Beego : http://beego.me/
- Revel : http://revel.github.io/
- Gorilla : http://www.gorillatoolkit.org/
- Gin-gonic : https://gin-gonic.github.io/gin/
- Goji : https://goji.io/
- Martini : http://martini.codegangsta.io/
- Traffic : https://github.com/pilu/traffic
- Gooo : https://github.com/aaronlifton/Gooo
You can use a dispatcher library like httprouter to get slightly more convenient URL routing and parameter capture. There are a whole bunch of "middleware" libraries that intercept requests and provide sessions, CSRF protection, &c --- and no one "framework" provides all of them.
But keep net/http visible in your code. It'll maximize compatibility with other libraries, keep you from having to write bizarre shims, and ensure your code is idiomatic.
When someone writes a library that coherently unifies persistence and request handling and view rendering, it'll be time to consider frameworks. But current Golang frameworks aren't ambitious enough to be worth the headache of, in effect, coding to an idiosyncratic alternate universe of request handling.
If you make REST APIs, then you can use a micro-framework because there will be less boilerplate to get to what you want. Goji and Gin offer great performances compared to Gorilla, Martini and the others.
I see a lot of companies using Rails or Django for their main app and Go for their background processes. I think this approach is a good first step to get better performances and knowledge of Go, keeping the productivity of these frameworks to render HTML apps.
My experience of building complex web stuff in Golang is very similar to my experience of doing the same with Sinatra: you inevitably realize about 1/3rd of the way in that you're really just building an underspecified, undertested version of Rails itself.
(Assuming you build those, and I'm not suggesting that it would--more looking for additional viewpoints.)
I could do without it, but I like what it offers. The bee tool is nice. It lets you quickly bootstrap an app and using bee run provides hot recompile when your code is changed.
Beego docs are pretty good and the developer is very responsive to github issues.
What did you build with Revel? How would you compare to your previous web framework?
I looked at net/http and needed something a little more, but not too much more. I like that it only has 1 templating choice and no notion of a database / ORM. It feels like net/http on steroids.