Golang Project Structure

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

James Smith (Golang Project Structure Admin)

Author

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

Some Simple Suggestions for Structuring Go Code

The wall of a structure made out of bricks and mortar.

You don’t always have to think long and hard about structure: the easiest way to begin when writing Go code is just to create a main.go file and run it. In the past, this file would have had to be located in a package within the $GOPATH/src directory. However, since version 1.11 of the Go […]