go: more (minor) refactoring

Also fixes printing a wrong string in the JSON test