Channels are two way, and are about communication, not sharing memory. So perhaps instead of sending the entire slice, just sending the last item in each slice one way down the channel and then sending the second value back the other way.
func main() {
...
// send only the last item
theSlice := aMap[key]
channel <- theSlice[len(theSlice)-1]
// waiting for the response
theSlice[len(theSlice)-1] = <- channel
}
func transition(channel chan []float32) {
newSlice := make([]float32,5)
channel <- newSlice[len(newSlice)-1]
newSlice[len(newSlice)-1] = <- channel
fmt.Println(newSlice)
}
The above code does assume that the channel declaration has been changed away from a slice to just a float32 :
var channel = make(chan float32, 1)