mirror of
https://github.com/securego/gosec.git
synced 2024-12-26 04:25:52 +00:00
Fix some gas warnings
This commit is contained in:
parent
8b87505d97
commit
c2c21553a3
2 changed files with 12 additions and 5 deletions
|
@ -149,9 +149,15 @@ func saveOutput(filename, format string, issues []*gas.Issue, metrics *gas.Metri
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer outfile.Close()
|
defer outfile.Close()
|
||||||
output.CreateReport(outfile, format, issues, metrics)
|
err = output.CreateReport(outfile, format, issues, metrics)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
output.CreateReport(os.Stdout, format, issues, metrics)
|
err := output.CreateReport(os.Stdout, format, issues, metrics)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -166,7 +172,7 @@ func main() {
|
||||||
|
|
||||||
// Ensure at least one file was specified
|
// Ensure at least one file was specified
|
||||||
if flag.NArg() == 0 {
|
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()
|
flag.Usage()
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
@ -231,7 +237,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finialize logging
|
// Finialize logging
|
||||||
logWriter.Close()
|
logWriter.Close() // #nosec
|
||||||
|
|
||||||
// Do we have an issue? If so exit 1
|
// Do we have an issue? If so exit 1
|
||||||
if issuesFound {
|
if issuesFound {
|
||||||
|
|
|
@ -128,6 +128,7 @@ func (p *TestPackage) CreateContext(filename string) *gas.Context {
|
||||||
// Close will delete the package and all files in that directory
|
// Close will delete the package and all files in that directory
|
||||||
func (p *TestPackage) Close() {
|
func (p *TestPackage) Close() {
|
||||||
if p.ondisk {
|
if p.ondisk {
|
||||||
os.RemoveAll(p.Path)
|
err := os.RemoveAll(p.Path)
|
||||||
|
log.Println(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue