-
Notifications
You must be signed in to change notification settings - Fork 289
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
Add --exit-code to buf format #1033
Conversation
@@ -1944,19 +1944,6 @@ func TestFormatDiff(t *testing.T) { | |||
@@ -1,13 +1,7 @@ | |||
- | |||
syntax = "proto3"; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is affected if there is whitespace or not in the diff - this is kind of a mess across IDEs, just simplifying it to test what we need to
stdoutCopy := bytes.NewBuffer(nil) | ||
if stdout == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This came up as a panic in the tests when I had stdout
as nil - this makes it so that stdout/stderr
can be nil
Now we don't need to go through a helper script, because an `--exit-code` was added with bufbuild/buf#1033. Signed-off-by: Christopher Maier <[email protected]>
- Add `--exit code` flag to `buf format` to exit with a non-zero exit code if | ||
the files were not already formatted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(you may mean --exit-code not --exit code)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol, yes -- we were a bit excited about this. Thanks for catching this and we'll update the changelog :)
Fixes #1030.
This makes it so that
buf format
exits with a non-zero exit code if files were not already formatted. Common invocations: