in hook.go [44:60]
func (c *config) writeFile(path string) error {
bytes, err := json.Marshal(c)
if err != nil {
return err
}
// get current permissions and write with same permissions
var mode os.FileMode
info, err := os.Stat(path)
if err != nil {
// If the file isn't here we still want to write it
// default to 0666
mode = 0666
} else {
mode = info.Mode()
}
return ioutil.WriteFile(path, bytes, mode.Perm())
}