internal/gen: add WriteGo variants of WriteGoFile equivalents

This allows interjecting a final post-processing stage before writing
to a file. It also allows getting the error.

This will be needed in a generator for the language package soon.

Change-Id: Ieda51707a916410c163305fc1f676e063a4658a5
Reviewed-on: https://go-review.googlesource.com/14437
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2 files changed