DEV Community

Toul
Toul

Posted on • Originally published at toul.io

Most Popular GoLang Frameworks

Intro

A framework is typically an opinionated way of building something that a dev or group of devs have built and shared with the world. Web Dev frameworks are by far the most popular.

A web dev framework is one that provides templates and design patterns for building Web Applications like Google, Yahoo, FaceBook, InstaGram, Twitter, and so on. Some of the most popular web dev ones of all time are Ruby on Rails and Python's Django, but what if you're a GoLang programmer?

Don't worry.

In this post cost I'll cover not only the most popular web dev frameworks but also machine learning, micro services, static websites, CLI, and Desktop frameworks.

Let's get into it.

Web Dev GoLang Frameworks

Here are the top web dev frameworks for GoLang in order of those with the greatest amount of stars. I've added my thoughts and experience to each one to help you pick out which might be the one for your project. Personally, I tend to opt for ones with the highest amount of stars because that typically means a large userbase and large userbase means plenty help when you need it.

1.Gin-Gonic

Gin-Gonic is my personal choice if I hade to use a web dev framework because it is fast and has all the features that you could want in a framework for building a typical Create, Read, Update, Delete (CRUD) web app.

2.BeeGo

Is the most popular web dev framework used by those China, just have a look at their incredible sponsor list to see.

3.Iris

Iris is an incredible GoLang web dev framework that focuses on portability and cross-platform. So, I'd use it when wanting to take a web application and break it down to be run on AWS and Netlify in a hurry.

4.Kratos

Kratos is between a web dev framework and microservice framework and what works well with it is the fact that it is not tied to a particular infrastructure style.

5.Revel

Revel is a simple project that delivers well on parameter parsing, validation, session/flush, and caching so if those sound like things of high importance to you then this is the framework to choose.

6.Buffalo

Although, not the most popular on the list, Buffalo is my second favorite to use. It is incredibly beginner friendly with plenty of helpful code generation tools available out of the box. I'd recommend using this framework if you have a Ruby background or are just starting out with being a web dev.

Microservices GoLang Frameworks

The Microservice ideology is typically used with Docker and Kubernetes to build resilient web apps. It is an incredibly popular design style with GoLang, so there are a number of highly rated frameworks. I've included the top three below with links to their projects to make it easier for you to decide.

1.Echo

I would use Echo if you're wanting to have Automatic TLS, HTTP/2, and are using the RESTful API design paradigm.

2.GO-zero

I'd use Go-Zero if you want to save time on writing code because it includes a neat goctl cli tool to generate code for you. The command line tool can also generate iOS, Android, Kotlin, Dart, TypeScript, and JavaScript with one click as well!

3.go-micro

I'd use go-micro if Authentication was a big concern for the app that you're building. Authentication can be a huge burden for a team to build out. So it is nice to have it integrated right out of the box.

Command Line Interface - CLI Framework

Cobra

Cobra has been used to build the CLI's for the biggest technologies written in GoLang that power the cloud; kubectl, terraform, docker, and more.

So, trust that Cobra is the CLI framework that you'll want to use when building a sophisticated GoLang based CLI tool.

Although, it should be mentioned that the GoLang standard library has more than enough to build a simple CLI tool.

However, it is awesome to get the available features right out the box by using the framework:

  • Easy subcommands
  • POSIX-compliant flags
  • Nested subcommands
  • Intelligent suggestions
  • Automatic help generation for commands and flags
  • Automatic help flag recognition
  • Command aliases to change cmds without breakting them
  • Great integration with Viper package for 12-factor apps

Give Cobra a try the next time you're deciding to build a CLI tool.

Desktop Applications GoLang Framework

Wails

Typically, building a desktop application requires learning a completely different language but not with GoLang. Wails is a community project that not only lets you use GoLang to program a Desktop application, but in general a cross platform application.

If this seems confusing then think of Expo or Electron which do the same thing but with JavaScript.

Personally, my favorite combination to use with WAILS is the Svelte language as the frontend. In fact I won a hackathon using WAILS to build a desktop application for making DevOps easier for GitHub management.

Static Website GoLang Framework

HUGO

A static website is a website that typically runs without the content changing as the user interacts. It is perfect for someone who only wants to have a blog or website about a topic without having think about backend code. And GoLang has one of the fastest tools available for building and managing content--HUGO.

  • Stars:62k
  • Website: https://gohugo.io/
  • License: Apache-2.0 Hugo is exactly what I used to build FreeResumeScanner.com. Even though a static website may not typically have backend code, a common pattern with static websites is to have lambdas used as backend rather than having a server running 24/7.

Having a static website in the frontend that only uses compute as you need it is sometimes called a Single Page Application or FullStack - Serverless.

The benefits of using Single Page Application architecture is that you save a lot of money– in fact FreeResumeScanner.com is ran to be completely FREE for me as the host.

If you have an app idea but don't want to get lost in server management and costs then check out How to use GoLang, Hugo, and Lambda for a Single Page Application where I show you exactly how to build FreeResumeScanner.com so that you can swap it out with your idea.

Web Scraping GoLang Framework

A good webscraper can make life easy for your data gathering efforts. And for GoLang enthusiasts there's only one worth mentioning.

Colly

Colly makes it easy because it handles some of the biggest problems you'll encounter while trying to collect data from the internet by having the following features built in:

  • Cookie and Session handling
  • Distributed Scraping
  • Caching
  • Google App Engine Support
  • Fast (>1k request/sec on a single core)
  • Automatic request delays and max. concurrency per domain

Each one of those features helps to mitigate bot protection from websites. Even though plenty of big tech companies scrape websites, some of them don't like it when others do and try to stop it from happening. But, the features above serve to work around bot control efforts.

So, the next time you're working on a data analytics project with GoLang, give Colly a try for the data collection phase, if there's no database available.

Machine Learning GoLang Frameworks

Machine learning in other languages like Python, R, and Scala is incredibly easy given the robust frameworks built by communities. Unfortunately, machine learning in GoLang is barren in comparison. But there is one well-known framework that is used by the community and that's Gorgonia.

GORGONIA

Gorgonia has the basics in place to help you create your own Machine Learning algorithms from scratch. It also has linear regression , multi-dimensional arrays, and neural networks available out of the box.

All three can get you started and if you want any others then it might be worth looking into implementing your own.

Since, GO 1.18 introduced generics it might be easier than you think.

Top comments (2)

Collapse
 
imamdev_ profile image
Imamuzzaki Abu Salam

Great post! I love it 💖 Was looking for so long.

Collapse
 
terraier profile image
Toul

Glad It was helpful :)