func writeFile(p string, fn func(w io.Writer) error) error {
	f, err := os.OpenFile(p, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
	if err != nil {
		return err
	}
	if err := fn(f); err != nil {
		f.Close()
		return err
	}
	return f.Close()
}
// writeFile creates a file at p and passes it to fn.
writeFile creates a file at p and passes it to fn.
// writeFile creates a file at p and passes it to fn .
func writeFile(p string, fn func(w io.Writer) error) error {
	f, err := os.OpenFile(p, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
	if err != nil {
		return err
	}
	if err := fn(f); err != nil {
		f.Close()
		return err
	}
	return f.Close()
}
func writeFile ( p string , fn func ( w io . Writer ) error ) error { f , err := os . OpenFile ( p , os . O_RDWR | os . O_CREATE | os . O_TRUNC , 0644 ) if err != nil { return err } if err := fn ( f ) ; err != nil { f . Close ( ) return err } return f . Close ( ) }
writeFile creates a file at p and passes it to fn.
writeFile creates a file at p and passes it to fn .