A nil slice has no underlying array. Its length and capacity are both :
var s []int // nil slice
fmt.Println(s == nil) // true
fmt.Println(len(s)) // 0
You can append to a nil slice. The append function handles the allocation. An empty slice []int{} is not nil but also has length . For most purposes, nil and empty slices behave the same.