goraft/raft — pull request #209 by tsenart (2014-03-27 13:13:49+00:00)
Title: util: Handle all errors in writeFileSync

Before this patch, errors returned by `f.Write` would be swallowed and
replaced by io.ErrShortWrite if the number of bytes written was less than the
number of bytes to be written.

etcd was panicking on startup because it had no space to write conf.tmp to its
data directory and the panic string was "short write" which was not very
informative of the real problem.

After applying this patch, we got a nice error message in our panic:
"panic: write /data/etcd/conf.tmp: no space left on device"