I'm looking into some Golang web frameworks (specifically Beego, Echo, Gin, Iris, and Revel). I'm wondering which of these, if any, is the most popular or widely used.
I've also seen people mention that Go frameworks aren't necessary, which I also could see. The standard Http library is quite robust (or using something like Gorilla).
Just curious about this communities take.
评论:
mixedCase_:
diegobernardes:Standard lib with a third party router.
I like Chi. It's idiomatic and fast as hell.
I also use some of Gorilla's middleware.
lwcd:Chi is amazing, i'm using in all my projects.
hoffentlich:Seconded. Chi + net/http is pretty much all you need
BubuX:Not Iris, really no. Between the ones you listed, Gin and Echo are the most popular and used in production, if any framework is being used at all. Gin has proven itself. I hear Echo is production ready as well but I only played with it a bit. Gin may have a bit more than Echo in terms of middlewares and such. Not sure.
/edit ah and also gorilla is quite popular with those who don't like using a framework and instead prefer to integrate different parts with the http module from the standard lib, which is a good approach. Depends on your needs.
bkeroack:context about Iris: http://www.florinpatan.ro/2016/10/why-you-should-not-use-iris-for-your-go.html
iends:
stdlib
Although at this point I'm starting to advocate implementing everything in GRPC natively because then you can autogenerate a JSON HTTP1.1-compliant server AND api docs (Swagger) at the same time.
bkeroack:This is an interesting idea, is there somewhere I can read more other than the linked github project?
yami_odymel:http://www.grpc.io mainly. You can also Google for a bunch of talks about GRPC and Go.
With GRPC you define your service in a protobuf file with strongly-typed inputs and outputs. Native GRPC clients use that, while the linked project autogenerates a JSON API server for legacy HTTP 1.1 clients.
darkmagician2:Don't use gRPC of your client is a browser. It's hard to communicate with a browser via Protobuf. Yes, you can generate the JSON API but it's a mess.
goomba_gibbon:Not anymore. https://spatialos.improbable.io/games/grpc-web-moving-past-restjson-towards-type-safe-web-apis
sdomino:May I ask a bit more about what it's for? Default response is "standard library" (for good reasons) but it will definitely depend on your use-case.
edit: I also hear good things about buffalo but I haven't tried it personally - http://gobuffalo.io/docs/getting-started
shovelpost:Really I'm just trying to get a sense of whether or not there is something other than the standard lib that is emerging as a popular web framework (Ruby has Rails, Elixir has Phoenix, etc.)
edit: I'm writing a high level "how to" article for one of the Golang frameworks that Nanobox supports (https://guides.nanobox.io/golang/), and I wanted to get an idea of whether or not there was a framework that would benefit most from such an article (help the most people).
aboukirev:The community is trying its best to avoid falling into the framework pitfall.
:The following is not targeted at you but at "the community".
Once to get to a sizable Web application where a you need to cover serving static files, content negotiation, chunking (download, upload), processing OPTIONS, proper caching headers, real IP behind proxy, authentication, caching templates, form binding, etc. you'll need an existing 3rd party framework or roll your own (you'll want to reuse that in other projects, right?). Either way, framework it is. If you want to call it a collection of libraries, go ahead. IMO, there is nothing wrong with using a framework so long as it works and is flexible enough.
Want a UI? Is OpenGL enough? Sure you can do everything with it. No UI frameworks. /sarcasm
shovelpost:[deleted]
kaeshiwaza:If possible please remove Iris from the Nanobox support for these reasons.
PaluMacil:I wonder if gorilla session is still recommended lib since 1.7+ ? Or maybe https://github.com/alexedwards/scs ?
andradei:My impression is Gorilla toolkit libraries (especially mux) or standard library are the most popular choices since Go devs seem to avoid heavy or complex full frameworks. Gin seems to be next. The others you mentioned are less common in production, but Go is just built to make great web api an easy accomplishment. Chi seems to have good momentum but I personally don't know anyone using it in their commercial work. I'll hopefully get around to trying it soon.
Buffalo is pretty good too, but I'm not sure whether it is production-ready though the project is very active.
