Minor Go cleanups

Also, use json.NewEncoder instead. It generates less garbage, especially in Go tip (after 1.1).

And trust the Content-Length detection. It works.