Fix test script

The test script was not running gofmt properly. I've fixed this issue and rejiggered the script to make it more readable.