go: Fix an infinite loop with some incomplete input

Closes #167.