Added error vars so people can better detect what error happened.

Include a decoder/encoder interface to clean up the code a bit, both
JSON and XML have a Decoder/Encoder type that implement the interfaces.
As well as the encoding/gob package.

Replace the ioutil implementation with a more idiomatic reader/writer
version using *os.File and the Decoder/Encoder types provided by the
json and xml packages.