This adds a test to show the problem, then fixes the problem. Also cleans up the code a little bit. The origin of the problem was the very famous Go for loop gotcha with pointers to the loop variable. No matter how long you've worked in Go, this mistake sometimes happens. It will be permanently fixed in Go 1.22. Can't wait.
This adds a test to show the problem, then fixes the problem. Also cleans up the code a little bit. The origin of the problem was the very famous Go for loop gotcha with pointers to the loop variable. No matter how long you've worked in Go, this mistake sometimes happens. It will be permanently fixed in Go 1.22. Can't wait.