Switch on type instead of if else chain, and go fmt