From 34ffb4948643252c2ad2960e453c76ec47f6d469 Mon Sep 17 00:00:00 2001 From: Kevin Fox Date: Sat, 26 Oct 2024 08:33:34 -0700 Subject: [PATCH] Test lint Signed-off-by: Kevin Fox --- main.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 1d671c3..354d18a 100644 --- a/main.go +++ b/main.go @@ -98,7 +98,10 @@ func updateConfig(url string, cas string, source string, dest string) { urlFound := false var config yaml.Node var caRef *yaml.Node - yaml.Unmarshal(b, &config) + err = yaml.Unmarshal(b, &config) + if err != nil { + log.Fatalf("Problem unmarshaling config: %v", err) + } for _, d := range config.Content { jwtFound := false for _, j := range d.Content { @@ -148,8 +151,15 @@ func updateConfig(url string, cas string, source string, dest string) { if err != nil { log.Fatalf("Problem creating file: %v", err) } - yaml.NewEncoder(f).Encode(config.Content[0]) + enc := yaml.NewEncoder(f) + err = enc.Encode(config.Content[0]) + if err != nil { + log.Fatalf("Failed to encode content: %v", err) + } name := f.Name() f.Close() - os.Rename(name, dest) + err = os.Rename(name, dest) + if err != nil { + log.Fatalf("Failed to rename file into place: %v", err) + } }