Make, New and Literals Cheat Sheet – Slice and Map Initialization in Go

golang gopher slice literal

There are quite a few ways to create new maps and slices in Go. Which one is best? Or perhaps better asked, which one is best in your situation? Let’s take a look. Slices var varStyle []string is the idiomatic way to declare an empty slice. The slice is actually nil, which means it will … Read more Make, New and Literals Cheat Sheet – Slice and Map Initialization in Go