Golang Project Structure

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

go programming

Tag

Interview With the Go Developer: Jon Rafkind

Headshot of the software engineer and Go programmer Jon Rafkind.

This is the first in an upcoming series of interviews with professional software developers who use Go in their work and amateur coders who use it in their personal projects. This first interview is with Jon Rafkind, who is a senior software engineer with around 8 years of experience using Go. He has an undergraduate […]

Removing a Substring From a String in Go

A hand holding a pair of scissors.

In this blog post, we will explore several approaches that can be used to remove a substring from a larger string in Go, covering both basic cases and more complex scenarios. By the end of this guide, you should have a solid understanding of various ways to strip substrings from strings in Go and how […]

Getting the Directory of the Currently Running File in Go

An old-fashioned directory system with paper records in wooden drawers at a library.

When writing Go code, it can often be useful to know how to obtain the path to the directory where the file being currently executed is located. In this post, we’ll explore how to do this in Go and discuss some of the practical applications of this knowledge. Why Would I Need the Directory of […]

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 […]