Skip to content

Commit

Permalink
Fix empty error message in GenerateReport function
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Krivak authored and svishwanath-tw committed Oct 12, 2019
1 parent 75cd5b2 commit b2b7fbd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ const jsonFileName string = "report.json"
const htmlReportDir string = "talisman_html_report"

// GenerateReport generates a talisman scan report in html format
func GenerateReport(r *detector.DetectionResults, directory string) (string, error) {
func GenerateReport(r *detector.DetectionResults, directory string) (path string, err error) {

var path string
var jsonFilePath string
var homeDir string
var baseReportDirPath string
Expand Down Expand Up @@ -51,8 +50,9 @@ func GenerateReport(r *detector.DetectionResults, directory string) (string, err

jsonFile, err := os.Create(jsonFilePath)
defer func() {
err = jsonFile.Close()
log.Fatalf("error closing file %s: %v", jsonFilePath, err)
if err = jsonFile.Close(); err != nil {
err = fmt.Errorf("error closing file %s: %v", jsonFilePath, err)
}
}()

if err != nil {
Expand Down

0 comments on commit b2b7fbd

Please sign in to comment.