

Ask HN: Which Go Web Framework (Pros and Cons)? - areski

After playing with the net&#x2F;http package to understand how it works, I tried Gorilla and Beego.<p>Beego is a &quot;batteries included&quot; 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).<p>I would love if we can talk about our experience with Web Framework.<p>Which Framework are you using? How you compare it to your former web framework?
What are the Pros&#x2F;Cons?<p>Here a short list of the popular Go Web Frameworks:<p>- Beego : http:&#x2F;&#x2F;beego.me&#x2F;<p>- Revel : http:&#x2F;&#x2F;revel.github.io&#x2F;<p>- Gorilla : http:&#x2F;&#x2F;www.gorillatoolkit.org&#x2F;<p>- Gin-gonic : https:&#x2F;&#x2F;gin-gonic.github.io&#x2F;gin&#x2F;<p>- Goji : https:&#x2F;&#x2F;goji.io&#x2F;<p>- Martini : http:&#x2F;&#x2F;martini.codegangsta.io&#x2F;<p>- Traffic : https:&#x2F;&#x2F;github.com&#x2F;pilu&#x2F;traffic<p>- Gooo : https:&#x2F;&#x2F;github.com&#x2F;aaronlifton&#x2F;Gooo
======
tptacek
Don't use any framework.

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.

------
nmerouze
If you want to render HTML, there's a lot of security features that you won't
get with micro-frameworks. And even Beego and Revel have a lot to do to catch
up with Rails and Django. So for this type of apps, I would stay with Rails or
Django for now (depending on your preferences).

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.

~~~
tptacek
Yes, I also think, if you're the kind of developer who _wants_ a framework:
Rails is probably an objectively better choice. My default "stack" is Rails
front-end and Golang for JSON RPC stuff on the backend. Golang is nowhere
close to Rails in terms of flexibly converting an SQL database to HTML.

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.

~~~
areski
I have been long time Django/Flask users, and undoubtedly a good web
frameworks give you some structures, security and impose good practices to new
programmers, that's what I'm trying to find out. I'm not very aware of how
advanced Go Framework are, but if there is something that could replace nicely
my current Python web stack, I would be happy to give it a go.

------
dougbarrett
I use martini, I know it's notoriously the most hated framework for go, but I
find myself very productive. With martini and gorm/mgo I can get apps up and
running VERY quickly. Its never been a bottleneck for performance for me. I
know down the line I'll try something more efficient, but the fact I'm able to
develop CRUD apps at a rapid rate helps my job and helps me find more work.

------
wtf_is_up
I'm enjoying beego. It provides most of what I need. I don't use the ORM
because I like the flexibility of lib/pq + sqlx.

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.

------
bketelsen
I've tried them all. I went from the extreme of Revel (very rails-like) to
straight net/http. I ended up using Goji for my most recent API and really
like the feel. It's very close to net/http with just enough candy to make it
easier on me without losing straight net/http compatibility.

------
cauterize
Happy Revel user here. If you have any questions I'd be happy to share my
experiences.

~~~
areski
I've been reading this before trying beego and it kind of push me to try Beego
first [http://madewithdrew.com/blog/choosing-a-go-web-
framework/](http://madewithdrew.com/blog/choosing-a-go-web-framework/)

What did you build with Revel? How would you compare to your previous web
framework?

~~~
cauterize
A simple data gathering and report building app. The previous web framework
was Perl/Mojolicious, but that is not a good comparison.

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.

------
gchaincl
goji, mainly because it supports einhorn

