Golang Project Structure

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

Playing With the Fibonacci Sequence in Go

You may have studied the Fibonacci sequence in school, but it’s also useful to know how to work with Fibonacci numbers as a professional software engineer or web developer, because it’s the kind of thing that job interviewers may ask us questions about when they want to test our knowledge or gauge our ability to […]

How to Generate Safe and Secure Passwords

There are many services online that will claim to create unique, reliable and secure passwords for you, but can you trust other people’s code? It’s hard to know. Often you can trust the largest and most popular websites, but sometimes there are bugs or even intentional backdoors that will expose your generated passwords to the […]

Drawing an Awesome Chessboard in Go

Since chess is one of the oldest games in the world, the black-and-white chessboard is an instantly recognizable design. It originated in Asia around 1,500 years ago. In this post, we’ll create an image of a chessboard in the Go programming language. But we’ll gradually think through the problems involved before we actually draw it. […]

Bitmasks and Binary: What Does That Weird Pipe Character Do?

We all know what piping looks like in the real world, but when we talk about pipes in computing, we’re not necessarily all talking about the same thing. I’ve Seen Pipes in Linux and Mac OS In UNIX-based operating systems, the pipe character, also known as the vertical bar, is used to send the output […]

Writing Secret Messages With a Caesar Cipher

A statue of the Roman general Julius Caesar.

I’m going to show you one of the simplest methods available to secure a message, making it harder for unwitting observers to read. A cipher is a word used for a method that allows text to be encrypted or decrypted — in other words, made harder to read and then restored to an original form. […]

Are Golang Maps Thread-Safe?

Concurrency is such an integral part of Golang, because modern computers tend to have multiple processors and threads that code can run on. It’s therefore important that the data structures we use can be used across multiple threads — or, in our language, goroutines. A map in Golang is equivalent to a dictionary in Python […]

A Few Words of Wisdom

A man holding a banana as though it were a lethal weapon.

Languages that try to disallow idiocy become themselves idiotic. —Rob Pike, one of the creators of the Go programming language Many programming languages — such as C++ or Java, for example — introduce all kinds of complex abstractions that are intended to stop the person writing code in the language from doing something that they […]

Reversing a Slice

Slices in Go are equivalent to the data structures known as dynamic arrays or vectors in other programming languages. They simply allow us to collect data of the same type together, making it easy to access and pass around. Sometimes you may want to reverse the current order of your data, and this post discusses […]