in main/files.go [83:101]
func postProcessFile(path string) error {
ok, err := preprocess.IsTextFile(path)
if err != nil {
return errors.Wrapf(err, "error determining if script file")
}
if !ok {
return nil
}
b, err := ioutil.ReadFile(path) // read the file into memory for processing
if err != nil {
return errors.Wrapf(err, "error reading file")
}
b = preprocess.RemoveBOM(b)
b = preprocess.Dos2Unix(b)
err = ioutil.WriteFile(path, b, 0)
return errors.Wrap(os.Rename(path, path), "error writing file")
}