Explicit error handling: get_git_dir

As we rely on defer to clean up temporary files, log.Fatal is not
useful. Introduce explicit error handling to fix cleaning up temp
files.
Explicit error handling: get_toplevel
Explicit error handling: get_git_prefix
Explicit error handling: is_inside_gopath
Explicit error handling: refactor run() out of main
Explicit error handling: complete the refactor