Golang Project Structure

Tutorials, tips and tricks for writing and structuring code in Go (with additional content for other programming languages)

go programming

Tag

Discovering Whether One String Contains Another in Go

Five pieces of string arranged in a circular ring. Four of the rings of string each contain another ring of string.

When working with strings in Go, one common task is checking whether one string contains another. While this may seem straightforward, Go offers several methods, each with varying levels of complexity depending on the needs of your application. Whether you’re performing a case-sensitive substring search, looking for the index of a substring or diving into […]

Easy Guide to Using MongoDB With Go

A large pile of paper documents.

MongoDB is a popular NoSQL database, known for its flexibility and scalability. Its flexible schema allows developers to work efficiently with different data types, making it well-suited for dynamic and rapidly evolving applications. MongoDB stores data in JSON-like format called BSON (Binary JSON), which makes it a great choice for handling large-scale and relatively unstructured […]

Why Does Go Have So Many Different Kinds of For Loop?

A long-exposure photograph of a roundabout at night. No cars can be seen, but the trail left by their white and red headlights and taillights remains.

Anyone with experience of a C-based programming language will be immediately aware of how useful and fundamental for loops are. C also has while and do–while loops. JavaScript has a forEach method, which allows us to iterate over arrays, and it also has iterator objects. Go only really has the for loop. However, this single […]

How to Write a Rate Limiter in Go

A tortoise from the Galapagos Islands in South America. It is a famously slow-moving animal.

Web applications are used by more of us than ever before. With this growth comes a significant challenge: how can a web developer or administrator manage user traffic effectively and ensure that services remain stable, responsive and secure? Rate limiting serves as a crucial technique in addressing this challenge, allowing developers to control how frequently […]

Rob Pike’s Go Proverbs (Part Three)

A man with his legs crossed and his eyes closed. He is deep in meditation. The man is wearing a blue gown.

This is the third and final part of a three-part series on the Go proverbs that were devised by Rob Pike. We shall discuss and explain each of the remaining proverbs in turn. In this final instalment, we shall consider the remaining proverbs, discussing their meaning and their practical application. Each proverb reflects a core […]

Building Real-Time Applications With Go and WebSockets

A professional woman working on a laptop while sitting cross-legged on a bed in a hotel room.

Real-time applications (RTAs) have become an important part of modern software development. From live chat applications to stock market updates and online gaming, users now expect instant interaction with all kinds of services. While traditional HTTP request-and-response models may work well for many projects, they often fall short when it comes to implementing real-time communication […]

Who Owns Golang?

A confident and rich businessman standing in modern city, surrounded by skyscrapers. He has been successful in business, and he is wearing a suit and sunglasses.

In the world of open-source software, the question of ownership can be surprisingly complex. This is especially true for Go, a language that began as an internal project at Google but has since evolved into a global phenomenon, supported by a vast and passionate community of developers. It’s easy to assume that because Go originated […]

What Does It Mean to Say That Go Is Garbage Collected?

A dumpster on a street. It is filled with garbage, waste and trash. The dumpster is used as a visual metaphor for the importance of garbage collection in programming languages.

Memory management is critical in any programming language. In traditional languages like C and C++, developers manually manage memory through the allocation and deallocation of resources. However, in modern programming languages like Go, memory management is automatically handled by a garbage collector (GC). This feature is one of Go’s greatest strengths, since it allows developers […]