Go error: non-constant array bound

Solution 1:

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)