Golang package evaluation

We are going to develop go rest API and gRPC for production for our client . We found some libraries and packages.

Rest Services(https):

  1. Standard library - Go Packages
  2. Gin framework
  3. Gorilla/Mux
  4. Go kit
    Test case framework:
  5. testing package - testing - Go Packages
  6. GitHub - stretchr/testify: A toolkit with common assertions and mocks that plays nicely with the standard library

HTTP Load Testing: Jmeter and Vegeta.

gRPC: grpc package - google.golang.org/grpc - Go Packages

load testing tool : GitHub - bojand/ghz: Simple gRPC benchmarking and load testing tool

Please suggest best framework and lib.

Thanks in advance! Appreciate your response.

Hi! I’ll try to be more objective as possible. Generally i prefer to avoid web frameworks for small or “middle” size projects because when you involve a web f. you’re introducing more risks about maintenance/bugs for long time running plans, more dependencies (which means more weight and configuration adjustments) and, at least at your first steps on a specific web f., an amount of time to learn its how to.

  • For small/simple projects i’d go for Go Std Library + stdlib http.ServeMux + go testing tools (what you’ve listed at points 4 5 and 6 are valid). gRPC official go package.
  • For more complex projects I’d use the same stack more or less, substituting http.ServeMux with chi router (particularly great for middleware intensive apps) and, if you really need it, introducing gorm. I’d use Gin only if the application is large and the full Go code would result to convolute, or if you need several Gin capabilities.

So, why not gorilla/mux? IMHO gorilla is actually not well maintained, and httprouter is not maintained at all and remember that Gin is built on httprouter.

As an alternative, I’d use Fiber framework, built on fasthttp, much more performant than Gin and others, very clean, but not net/http compatible, so you must think about this if your service needs some specific net/http related projects like go-swagger for instance. It’s an other way to go, but it’s very funny and easy to use. It’s more or less Express in Go :slight_smile: