From 66166b1c494ed0213468b73f11307494cdaa1b8f Mon Sep 17 00:00:00 2001 From: segersniels Date: Fri, 19 Apr 2024 17:00:25 +0200 Subject: [PATCH] :recycle: Handle error return value --- apps/cli/config/config.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/cli/config/config.go b/apps/cli/config/config.go index b7b984d..c12a784 100644 --- a/apps/cli/config/config.go +++ b/apps/cli/config/config.go @@ -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 {