The slice type is commonly used as the idiomatic construct for indexed data in Go. The slice is more flexible and has many more interesting characteristics than arrays. The slice itself is a composite type with semantics similar to arrays. In fact, a slice uses an array as its underlying data storage mechanism. The general form of a slice type is given as follows:
The one obvious difference between a slice and an array type is omission of the size in the type declaration, as shown in the following examples:
var ( image byte ids string vector float64 months string q1 string histogram map[string]int // slice of map (see map later) )
The missing size attribute in the slice type indicates the following:
Unlike arrays, the size of a slice is not fixed
A slice type represents all sets of the specified element type
This means a slice can theoretically...