Skip to content

Commit

Permalink
Merge pull request securego#165 from cosmincojocar/fix_gas_warnings
Browse files Browse the repository at this point in the history
Fix some gas warnings
  • Loading branch information
gcmurphy committed Feb 8, 2018
2 parents a72a21b + c2c2155 commit ac4622d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
14 changes: 10 additions & 4 deletions cmd/gas/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,15 @@ func saveOutput(filename, format string, issues []*gas.Issue, metrics *gas.Metri
return err
}
defer outfile.Close()
output.CreateReport(outfile, format, issues, metrics)
err = output.CreateReport(outfile, format, issues, metrics)
if err != nil {
return err
}
} else {
output.CreateReport(os.Stdout, format, issues, metrics)
err := output.CreateReport(os.Stdout, format, issues, metrics)
if err != nil {
return err
}
}
return nil
}
Expand All @@ -166,7 +172,7 @@ func main() {

// Ensure at least one file was specified
if flag.NArg() == 0 {
fmt.Fprintf(os.Stderr, "\nError: FILE [FILE...] or './...' expected\n")
fmt.Fprintf(os.Stderr, "\nError: FILE [FILE...] or './...' expected\n") // #nosec
flag.Usage()
os.Exit(1)
}
Expand Down Expand Up @@ -231,7 +237,7 @@ func main() {
}

// Finialize logging
logWriter.Close()
logWriter.Close() // #nosec

// Do we have an issue? If so exit 1
if issuesFound {
Expand Down
3 changes: 2 additions & 1 deletion testutils/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func (p *TestPackage) CreateContext(filename string) *gas.Context {
// Close will delete the package and all files in that directory
func (p *TestPackage) Close() {
if p.ondisk {
os.RemoveAll(p.Path)
err := os.RemoveAll(p.Path)
log.Println(err)
}
}

0 comments on commit ac4622d

Please sign in to comment.