Skip to content

Commit

Permalink
♻️ Handle error return value
Browse files Browse the repository at this point in the history
  • Loading branch information
segersniels committed Apr 19, 2024
1 parent 548d6ee commit 66166b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/cli/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ func (config *Config[T]) Save() error {
defer file.Close()

// Clear the file before writing to it
file.Truncate(0)
if err := file.Truncate(0); err != nil {
return err
}

// Write the configuration to the file
if err := json.NewEncoder(file).Encode(&config.Data); err != nil {
Expand Down

0 comments on commit 66166b1

Please sign in to comment.