-
-
Notifications
You must be signed in to change notification settings - Fork 219
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
Use io.Discard instead of /dev/null for discarding output #354
Conversation
loggers/serial_writer.go
Outdated
} else { | ||
file = io.Discard | ||
// Nothing to close so just set a no-op | ||
sl.file = io.NopCloser(&bytes.Buffer{}) |
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.
We still don't have a mechanism to close WAF instances. It should handle closing log writters and audit writters.
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.
Just to confirm this is something to fix in another PR? Here we're just keeping the existing code working, i.e., to support the Close
method on line 58
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.
LGTM
Hi all, this has been open for a while can it be merged? |
Writing to
/dev/null
is still a system call which adds quite a bit of overhead even though we don't want to actually do anything.io.Discard
drops within Go code itself for much better efficiency, and a step towards Windows compatibility.Note: that go.mod and go.sum can only be modified for tested dependency updates or justified new features.
Make sure that you've checked the boxes below before you submit PR:
Thanks for your PR ❤️