feat: write file actually

main
sudo pacman -Syu 2022-11-28 00:39:59 +07:00
parent 7e155245db
commit de45843925
No known key found for this signature in database
GPG Key ID: D6CB5C6C567C47B0
1 changed files with 4 additions and 2 deletions

View File

@ -140,11 +140,13 @@ func (ft *Formatter) formatFile(path string) error {
}
if ft.isList {
fmt.Println(path)
fmt.Println("Formatted: ", path)
}
if ft.isWrite {
ft.log("TODO: write to file\n")
if err := os.WriteFile(path, formattedBytes, 0o600); err != nil {
return fmt.Errorf("os: failed to write file: [%s] %w", path, err)
}
}
if ft.isDiff {