Golang Project Structure

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

Can You Identify the National Flags of the World?

I wanted to create a fairly simple game, which would be fun to play but quick to build, so that I could upload it to Itch, the popular website that allows users to host their own indie games. My intention was to try and find out how easy — or hard — the process would […]

A Super Speed-up With Binary Search

In any programming language, there are two main algorithms used for finding a given value in an array: linear search and binary search. (Just to note: in Go, we generally use slices rather than arrays, but I’ll use those two terms interchangeably in this post, just for the sake of simplicity, since everything that I […]

Representing Money in the Go Programming Language

If you’re building a web app or program that handles sales from customers, you may need to find a reliable way of representing money in Golang. There’s no single way to do it, since the language does not have a primitive type that is intended to hold monetary values. In this post, I will go […]

Creating Cool Games With Ebiten

The Ebiten game framework was written by Japanese software engineer Hajime Hoshi. The framework is designed to make it easier for Go programmers to create native-looking 2D games, by taking care of all the boilerplate code for us. (Note that since I first wrote this post, Ebiten has been renamed to Ebitengine.) Installing the Ebiten […]

What We’ve Been Waiting For: Generics in Go

Climbing ropes in a children's playground.

It’s been a long time coming and it’s caused a certain degree of controversy among Gophers, but now we know, at last, that it’s really happening. Generics have been included in a beta version of Go 1.18, which was just released this week. What Are Generics? In a strictly typed language like Go, every argument […]

Replacing 12 Powerful Linux Bash Commands With Go

The command line on a Ubuntu Linux computer. This is where you would enter Bash commands.

Every serious software developer or system administrator must have at least a basic grasp of Bash commands, because they can often help you to manage computer systems much more efficiently and effectively than if you were only to use a point-and-click GUI. In this post we’re going to write Go code that will aim to […]

256 Shades of Grey: Converting Colour Images to Greyscale

A beautiful rainbow in a rural landscape.

In this post, I am going to show you how to transform a full-colour image into one made up entirely of different shades of grey. The sort of image that we will create is called greyscale, because every colour that makes up the image is stored as a position on a predetermined scale of greys […]

Scraping Stock Market Prices With Impressive Ease

Global stock markets increasingly affect everyone’s lives, whether we like it or not. Investors seek financial returns from profitable companies, and workers may find it easier to bargain for new jobs or pay rises when the markets are riding high, at least if they possess the sorts of skills that are in demand. Economists and […]