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

Make output modes configurable #60

Merged
merged 1 commit into from
Aug 22, 2016
Merged

Make output modes configurable #60

merged 1 commit into from
Aug 22, 2016

Conversation

if err != nil {
return err
}
defer os.Remove(f.Name())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my experience, worrying about the error from the defer is overkill, and creates complexity without much gain.

I agree.

Actually in my experience it was necessary to correctly deal with disk full in the target file system, temporary network issue or something. But as you said, worrying about that does not add much value in this specific case of short-living process unlike my experience.

I would have written (instead of line 31-49):

defer os.Remove(f.Name())
defer f.Close()
if _, err := f.Write(bzl.Format(file)); err != nil {
return err
}

Thank you for your suggestion. Fixed.
But I added Sync because Close used to also imply Sync in the original code.

@yugui
Copy link
Member Author

yugui commented Aug 18, 2016

@pmbethe09 Could you take another look at this PR?

}
defer os.Remove(f.Name())
defer f.Close()
if _, err = f.Write(bzl.Format(file)); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use := instead of = whenever possible, like here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@pmbethe09
Copy link
Member

LGTM with a couple of nitpicks.

Added "fix" and "diff" modes
@yugui yugui merged commit ad1cad2 into master Aug 22, 2016
@yugui
Copy link
Member Author

yugui commented Aug 22, 2016

Thank you for your review.

@yugui yugui deleted the feature/gazel_3 branch August 22, 2016 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants