Non-constant array bound

./mergesort.go:6: non-constant array bound leftLength
./mergesort.go:7: non-constant array bound rightLength

You can’t instantiate an array like that with a value calculated at runtime. Instead use make to initialize a slice with the desired length. It would look like this;

left := make([]int, leftLength)