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

Fix silent zig fmt errors #21948

Merged
merged 2 commits into from
Nov 11, 2024

Conversation

danielchasehooper
Copy link
Contributor

zig fmt would silently fail for paths that didn't exist. This caused me significant confusion when I was trying to format a file but I had a typo in the name - the command looked like it succeeded in the terminal, but the file wasn't changing.

The problem was due to using the warn log level for the error - in .ReleaseSafe and .ReleaseFast build modes .warn messages aren't printed. I think it's fair to use the error level since FileNotFound errors like this cause zig fmt to produce a nonzero exit code.

@danielchasehooper danielchasehooper changed the title fix silent fmt errors Fix silent zig fmt errors Nov 9, 2024
@danielchasehooper
Copy link
Contributor Author

The test failures seem to be unrelated to this change

@mlugg
Copy link
Member

mlugg commented Nov 10, 2024

Why do you believe the failures are unrelated to this change? That's a quite weird argument to make when all 10 runs failed in the exact same manner as one another, with each one reporting a formatting error in precisely the file you changed. As it is, the code you have written does not obey zig fmt.

@danielchasehooper
Copy link
Contributor Author

danielchasehooper commented Nov 10, 2024

That's a quite weird argument to make

Sorry, wasn't intended to start an argument, I made an honest misreading of the test output. Just trying to help.

I've run zig fmt.

@mlugg
Copy link
Member

mlugg commented Nov 10, 2024

Sorry, by "argument" I just meant "point"/"reason" here, I didn't mean for it to be interpreted as an accusation. Thanks!

@andrewrk andrewrk merged commit 560d6b9 into ziglang:master Nov 11, 2024
10 checks passed
@andrewrk
Copy link
Member

Thanks!

@danielchasehooper danielchasehooper deleted the fix_silent_fmt_errors branch November 11, 2024 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants