Golang REST framework comparison: gin vs echo

Yuil Tripathee
2 min readMay 26, 2019

--

The objective of this article is to conclude the selection among two competitive golang frameworks : gin and echo. There is a lot of confusion raised just because of having almost similar feature sets which laving narrow contrast in things like community support, quality documentation, and some technical overviews. This makes the framework look like twin-brothers with slightly different approach.

Although, Golang community recommends to use tailored vanilla code for your project over generalized library, it seems to be easier getting job done in record time using those frameworks once you grab the implementation ideas that suits well for your project.

We are targeting to build micro-service based project with a RESTful API and let’s see which works well with our purpose.

Framework Overview

Basic comparison

Gin was introduced a year before Echo, so there Gin seems to have more GitHub stars (by the date) which shows gin to be more active. But, rate of issue being solved is exceptional from Echo side.

Technical insights

Both of them allows:

  • Top gear performance
  • HTTPs
  • Full HTTP/2 support
  • File server
  • Logger

Using go-gin for custom HTTP error is tedious compared to go-echo, while go-echo has default HTTPs which is its advantage over Gin.

Where Gin wins?

Sample hello world program using Gin

Here are the some cases where Gin has a lead:

  1. Better logger implementation
  2. Single binary server build

Where Echo wins?

Sample Hello World program using echo

The competitive advantage of Echo over Gin are:

  1. Better quality documentation
  2. Custom HTTP error handler
  3. Load balancing
  4. File download
  5. Context extension

Conclusion

For the specific requirements of our project, we choose to use Echo for our RESTful API service, although using Gin instead does not make a lot of difference.

We chose Echo for having better documentation and custom HTTP error handler, being necessary for our development purposes.

Check out a basic go-echo REST implementation here: https://github.com/yuil-plug-and-play/go-rest-api

Here’s the guide for that:

https://medium.com/@yuiltripathee/simple-yet-high-performance-golang-rest-api-recipe-1622560ae23b

--

--