`ioutil.WriteFile` will do this for you