Skip to content

Commit

Permalink
Set O_TRUNC on mock output files
Browse files Browse the repository at this point in the history
This fixes #604
  • Loading branch information
LandonTClipp committed Apr 20, 2023
1 parent 5cf2282 commit 53b9d39
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/outputter.go
Expand Up @@ -288,7 +288,7 @@ func (m *Outputter) Generate(ctx context.Context, iface *Interface) error {

fileLog := log.With().Stringer(logging.LogKeyFile, outputPath).Logger()
fileLog.Info().Msg("writing to file")
file, err := outputPath.OpenFile(os.O_RDWR | os.O_CREATE)
file, err := outputPath.OpenFile(os.O_RDWR | os.O_CREATE | os.O_TRUNC)

Check warning on line 291 in pkg/outputter.go

View check run for this annotation

Codecov / codecov/patch

pkg/outputter.go#L291

Added line #L291 was not covered by tests
if err != nil {
return errors.Wrapf(err, "failed to open output file for mock: %v", outputPath)
}
Expand Down

0 comments on commit 53b9d39

Please sign in to comment.