Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #769 : Mock files getting created in disk when dry-run is enabled #775

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fixes #769 : mock file getting created in disk when dry-run is enabled
  • Loading branch information
harshvardhan.rajdan committed Apr 27, 2024
commit d2b16e01368f75fefabb0a22f2fc7e7b967bca62
15 changes: 9 additions & 6 deletions pkg/walker.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,15 @@ func (v *GeneratorVisitor) VisitWalk(ctx context.Context, iface *Interface) erro
return err
}

if !v.dryRun {
log.Info().Msgf("writing mock to file")
err = gen.Write(out)
if err != nil {
return err
}
// If we're in dry-run mode, avoid writing the mock to disk
if v.dryRun {
return nil
}

log.Info().Msgf("writing mock to file")
err = gen.Write(out)
if err != nil {
return err
}

return nil
Expand Down