Slice is the most important data structure in Go. When it comes to performance, slices are going to beat any other data structure. They are simple but powerful. However, there are some gotchas you have to keep in mind. Today, I’ll explain how slices work to help you prevent some hard to find bugs and write better code.
In Go, arrays have a fixed size. The length is part of the array’s type. It means that two arrays of integers but with different sizes are different types.