(path string, write func(io.Writer) error)
| 160 | } |
| 161 | |
| 162 | func writeFile(path string, write func(io.Writer) error) error { |
| 163 | f, err := os.Create(path) |
| 164 | if err != nil { |
| 165 | return err |
| 166 | } |
| 167 | if err := write(f); err != nil { |
| 168 | f.Close() |
| 169 | return err |
| 170 | } |
| 171 | return f.Close() |
| 172 | } |
| 173 | |
| 174 | // writeExportReport writes what each run printed, after its full command and |
| 175 | // the schema files it checked against. |