cmd/api: be more robust against OS deleting temp files
cmd/api: be more robust against OS deleting temp files

OS X in particular deletes tmp files (but not directories)
pretty reliably.

Ask hg whether the go.tools directory in tmp is good before
using it.

Fixes issue Rob and others were reporting, which I just hit
myself now.

R=golang-dev, r
CC=golang-dev
https://codereview.appspot.com/13084049

sanjosh/sanjos100-tipc,sanjosh/sanjos100-tipc,webfd/go-zh,bryanxu/go-zh,sanjosh/sanjos100-tipc,glycerine/jeaten-go-arrayof-structof,bryanxu/go-zh,webfd/go-zh,rdp/rogerpack2005-golang,glycerine/jeaten-go-arrayof-structof,webfd/go-zh,bryanxu/go-zh,rdp/rogerpack2005-golang,d0f/go-zh,webfd/go-zh,glycerine/jeaten-go-arrayof-structof,d0f/go-zh,sanjosh/sanjos100-tipc,sanjosh/sanjos100-tipc,rdp/rogerpack2005-golang,sanjosh/sanjos100-tipc,bryanxu/go-zh,rdp/rogerpack2005-golang,glycerine/jeaten-go-arrayof-structof,glycerine/jeaten-go-arrayof-structof,rdp/rogerpack2005-golang,bryanxu/go-zh,d0f/go-zh,rdp/rogerpack2005-golang,bryanxu/go-zh,bryanxu/go-zh,webfd/go-zh,d0f/go-zh,bryanxu/go-zh,rdp/rogerpack2005-golang,d0f/go-zh,glycerine/jeaten-go-arrayof-structof,webfd/go-zh,webfd/go-zh,d0f/go-zh,d0f/go-zh,rdp/rogerpack2005-golang,d0f/go-zh,glycerine/jeaten-go-arrayof-structof,webfd/go-zh,sanjosh/sanjos100-tipc,sanjosh/sanjos100-tipc,glycerine/jeaten-go-arrayof-structof