Skip to content

Commit

Permalink
fix: wipe out file content before writing output
Browse files Browse the repository at this point in the history
  • Loading branch information
ddlees committed Nov 16, 2022
1 parent a761735 commit e00a40d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sinks/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

func WriteToFile[T any](ctx context.Context, filePath string, stream <-chan T) error {

if file, err := os.OpenFile(filePath, os.O_CREATE|os.O_WRONLY, 0666); err != nil {
if file, err := os.OpenFile(filePath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0666); err != nil {
return err
} else {
defer file.Close()
Expand Down

0 comments on commit e00a40d

Please sign in to comment.