From 29c7bfbf4e011eb0eb34741e7ff5338c12112b58 Mon Sep 17 00:00:00 2001 From: Bobby Brennan Date: Mon, 22 Apr 2019 20:04:03 +0000 Subject: [PATCH] write output-file after sending to output-url --- main.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index 52433006..406c1c74 100644 --- a/main.go +++ b/main.go @@ -191,13 +191,6 @@ func runAudit(c conf.Configuration, outputFile string, outputURL string) { panic(err) } - if outputFile != "" { - err := ioutil.WriteFile(outputFile, []byte(jsonData), 0644) - if err != nil { - panic(err) - } - } - if outputURL != "" { req, err := http.NewRequest("POST", outputURL, bytes.NewBuffer(jsonData)) req.Header.Set("Content-Type", "application/json") @@ -216,5 +209,12 @@ func runAudit(c conf.Configuration, outputFile string, outputURL string) { glog.Println(string(body)) } } + + if outputFile != "" { + err := ioutil.WriteFile(outputFile, []byte(jsonData), 0644) + if err != nil { + panic(err) + } + } } }