Skip to content

Commit

Permalink
Use os.Create to truncate the results file if a previous one exists. (#…
Browse files Browse the repository at this point in the history
…940)

Signed-off-by: Caleb Brown <[email protected]>
  • Loading branch information
calebbrown authored Oct 26, 2023
1 parent a127b25 commit 1649e35
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/worker/runstatic.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func RunStaticAnalysis(ctx context.Context, pkg *pkgmanager.Pkg, sbOpts []sandbo
}

// create the results JSON file as an empty file, so it can be mounted into the container
resultsFile, err := os.OpenFile(resultsJSONFile, os.O_RDONLY|os.O_CREATE, 0o644)
resultsFile, err := os.Create(resultsJSONFile)
if err != nil {
return nil, "", fmt.Errorf("could not create results JSON file: %w", err)
}
Expand Down

0 comments on commit 1649e35

Please sign in to comment.