Bash 1 2 $ go version go version go1.19.1 darwin/amd64 Let’s consider a simple case of implementing a Map function in Go that maps an array (well, a slice) to another array (again, actually, a slice). Go 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 package main import ( "fmt" ) func Map (input [] int , mapFunc func ( int ) int ) [] int { output := make ([] int , 0 , len (input)) for _, val := range input { output = append (output, mapFunc (val)) } return output } func main () { input := [] int { 1 , 2 , 3 } squared := func (x int ) int { return x * x } output := Map (input, squared) fmt.