Golang Project Structure

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

idioms

Tag

Removing Elements From a Slice

I’ve written in the past about how to reverse the order of all the elements in a slice, but today I’m going to discuss some of the ways that elements can be removed — in other words, deleted — from a slice in Go. When looking at the various ways to remove one or more […]

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

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