Fix File to Close#4004
Conversation
Signed-off-by: hang.jiang <hang.jiang@daocloud.io>
lifubang
left a comment
There was a problem hiding this comment.
LGTM
Furthermore, do you know whether there is a way to detect such errors automatically or not?
|
@hangscer8 thanks, LGTM.
One way is to do a runtime check. I have added a test case doing that in #2802 (further improved in #3735). Problem is, it does not test every code path, and only checks for those leaks that are not a one-time thing. Thus, it does not detect issues fixed in this PR, because:
One other thing to note is, Go uses |
Need close file in time.