The thing about slices

Slices are tricky. If you have been using Go for a while now, you may be aware that a slice is basically a triplet consisting of a:

pointer to an array of values, the capacity of the array, the length of the array

This makes working with slices also a bit different than working with structs.

The slice operator

The first thing one should be aware of is that the slice operator, does not create and copy the data to a new slice. Not taking into account this fact, taking a look at the following...

 •  0 comments  •  flag
Share on Twitter
Published on August 06, 2017 11:00
No comments have been added yet.