Fiber – Express inspired web framework written in Go
github.com
github.com
This project is full of `interface{}` (sacrificing type safety for cuteness and magic), has a very weird prefork system (which actually breaks Go's concurrency model) and doesn't even use godoc (which is one of the nicest developer productivity aspects of Go). I would say it can do more harm than good to people new to Go.
1. fmt.Sprintf("Why doesn't %s have %s?\n", language, feature)
2. fmt.Sprintf("Builds %s in %s\n", feature, language)
3. fmt.Sprintf("Realizes %s actually sucks in %s and there are some good reasons nobody built it in the first place\n", feature, language)
Generally I think it's awesome people go down this path because sometimes really cool things are built as a result, but when the project in question overlaps with on-boarding from another tool, its is rife for another beginner to adopt it and get it stuck in production just because they wanted a slightly quicker transition from their former toolchain.
> Fiber started as a personal project to be able to rewrite all my node apps into Go. I tried to stick to the same workflow as Express by using interfaces, this is indeed not the Go standard.
But yeah, unless you want to do the same, I agree this project can definitely do more harm than good to new Gophers. It's awesome to do it as a personal experimentation and see if it can be done, but it's another thing to attempt to sell it to others as a good idea.
IMO even if you are using NodeJS, it's best spending some extra time actually learning the http module and only brings the pieces you really need, like a cookie parser, a body parser...
"URL routers" are convenient, but also highly overrated.
> This project is full of `interface{}` (sacrificing type safety for cuteness and magic), has a very weird prefork system (which actually breaks Go's concurrency model) and doesn't even use godoc (which is one of the nicest developer productivity aspects of Go). I would say it can do more harm than good to people new to Go.
Let's not however do a Martini 2.0. Let's keep criticism cordial this time instead of chasing away unorthodox library authors with public shaming. That episode was a black mark on the Go community. Not specifically talking about the parent comment however.
Projects like these are traps for newcomers.
Still, I'm not denying that it probably was a big learning experience for the author. Kudos to him for diving in and giving it a go.
> This project is full of `interface{}`
Oh boy.
app.Get("/", func(c * fiber.Ctx) { c.Send("Hello, World!") })
app.GET("/", func(c * gin.Context) { c.String(200, "Hello World!") })
app.GET("/", func(c echo.Context) error { return c.String(http.StatusOK, "Hello, World!") })
app.Get("/", func(ctx iris.Context) { ctx.Write("Hello World!") })
app.Get("/", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Hello World!")) }) //chi
There are so many micro web frameworks in Go that follow almost exactly the same pattern. It's hard to see how Fiber is substantially different.
Fiber also uses the empty interface a lot in its code. For example, app.Get() just takes `args ...interface{}`. By contrast, Gin's app.GET() takes `relativePath string, handlers ...HandlerFunc`. You know what Gin is expecting you to pass in.
I write raw Go fronted by Chi when I need to write APIs in Go. I never write web applications in Go; it's usually a mix of things, and often a Laravel app consuming a Go backend.
I'm offering this commentary solely as a point of reference and not a condemnation or judgment of others' patterns.
Gin has 1000s of production users right now. Please evaluate carefully before choosing one or the other.
Please evaluate carefully before choosing any Go web framework.
I hate the bullshit elitist crap like "oh don't learn that, you can't code in Go until you've learned x,y,z". Everybody learns differently. I learned jQuery before learning JavaScript.
I wish the people on this thread would stop assuming everyone is clones of them.