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

vfmt: exit with error code if encountering diffs with -diff flag #21603

Merged
merged 2 commits into from
May 30, 2024
Merged
Changes from all commits
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
6 changes: 4 additions & 2 deletions cmd/tools/vfmt.v
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ fn main() {
}
ecode := if has_internal_error { 5 } else { 0 }
if errors > 0 {
eprintln('Encountered a total of: ${errors} formatting errors.')
if !foptions.is_diff {
eprintln('Encountered a total of: ${errors} formatting errors.')
}
match true {
foptions.is_noerror { exit(0 + ecode) }
foptions.is_verify { exit(1 + ecode) }
Expand Down Expand Up @@ -245,7 +247,7 @@ fn (mut foptions FormatOptions) post_process_file(file string, formatted_file_pa
return
}
println(diff.compare_files(file, formatted_file_path)!)
return
return error('')
}
if foptions.is_verify {
if !is_formatted_different {
Expand Down
Loading