Original post

With Go, you can find the length of an array (or more accurately a slice) by using the internal len() function. Our example shows us creating a slice and then printing out it’s length, then adding an extra item and printing the length again.
package main import “fmt” func main() { // Create an exmaple array array := []int{1, 2, 3, 4, 5} // Print number of items fmt.Println(“First Length:”, len(array)) // Add an item and print again array = append(array, 6) fmt.