Skip to content

Commit

Permalink
truncate files
Browse files Browse the repository at this point in the history
  • Loading branch information
therealpaulgg committed Mar 20, 2023
1 parent 6fac24e commit e0e3dab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/utils/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func WriteConfig(hosts []models.Host) error {
return err
}
}
file, err := os.OpenFile(filepath.Join(p, "config"), os.O_WRONLY|os.O_CREATE, 0644)
file, err := os.OpenFile(filepath.Join(p, "config"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
if err != nil {
return err
}
Expand Down Expand Up @@ -60,7 +60,7 @@ func WriteKey(key []byte, filename string) error {
return err
}
}
file, err := os.OpenFile(filepath.Join(p, filename), os.O_WRONLY|os.O_CREATE, 0600)
file, err := os.OpenFile(filepath.Join(p, filename), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
if err != nil {
return err
}
Expand Down

0 comments on commit e0e3dab

Please sign in to comment.