← all field notes
say hi

Why Go Is My Backend Language of Choice

1 min read #go #backend #programming

I have written backend services in JavaScript, TypeScript, PHP, and Java. They all work. But when I need to build something that needs to be fast, reliable, and easy to deploy, I reach for Go.

Simplicity

Go is intentionally simple. There are no classes, no inheritance, no generics (until recently, and even now they are limited), and no exceptions. The entire language can be learned in a day.

This simplicity is a feature. Code is read more than it is written. Go code is easy to read, easy to understand, and easy to maintain.

Concurrency

Goroutines are lightweight threads managed by the Go runtime. You can run thousands of them without breaking a sweat. Channels make communication between goroutines safe and simple.

go func() {
    // This runs concurrently
}()

That is it. No async/await, no promises, no callbacks. Just go and it runs.

Fast compilation

Go compiles in seconds, even for large projects. The resulting binary is a single file with no dependencies. Deploy it to a server and it just works.

Great standard library

Go’s standard library is excellent. HTTP servers, JSON parsing, database drivers, testing, and more are all built in. You do not need to install a dozen packages to get started.

Frameworks I use

I mostly use:

  • Gin. Fast HTTP framework with a simple API
  • chi. Lightweight router with middleware support

Both are minimal and do not get in my way.

When I do not use Go

Go is not great for everything. Frontend work, quick scripts, and some types of applications are better served by other languages. But for backend services, APIs, and microservices, Go is my default.

Getting started

If you want to learn Go, start with A Tour of Go. Then build something small. A CLI tool, a simple API, a Discord bot. You will be productive in a weekend.

Biraj, from basecamp in Sindhuli, Nepal

Questions

Why use Go for backend services?
Go compiles to a single binary, starts fast, and handles concurrency with goroutines. The standard library covers HTTP, JSON and testing, so a service needs very few dependencies.
Which Go frameworks does Biraj Rai use?
Mostly Gin for HTTP services, and chi when a lighter router with middleware is enough. Both stay out of the way of the standard library.
When does he not use Go?
Frontend work, quick scripts and some kinds of applications are better served by other languages. For APIs and backend services, Go is the default.
Next trail Why I Use Arch Linux follow Yakku →