-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
serialfile: localize os.Open into NewSerialFile #1629
Conversation
0d4d18d
to
9219fc1
Compare
@@ -42,21 +36,11 @@ func newSerialFile(name, path string, file *os.File, stat os.FileInfo) (File, er | |||
|
|||
// for directories, stat all of the contents first, so we know what files to | |||
// open when NextFile() is called | |||
contents, err := file.Readdir(0) | |||
contents, err := ioutil.ReadDir(path) |
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.
why change this? we already have the file. no need to make an extra syscall
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.
What if os.Open()
is done only when !stat.IsDir()
?
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.
Not possible because in NextFile()
, f.Close()
requires the opened os.File
object.
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.
Still possible but then NextFile()
no longer uses newSerialFile()
.
3ed13af
to
0d36141
Compare
LGTM. @whyrusleeping ? |
I think this needs rebasing on top of symlink PR |
0d36141
to
9b48ede
Compare
9b48ede
to
6ff746f
Compare
Rebased |
that goprocess issue is happening more and more frequently. Otherwise, this LGTM |
License: MIT Signed-off-by: rht <rhtbot@gmail.com>
License: MIT Signed-off-by: rht <rhtbot@gmail.com>
6ff746f
to
0c95ed6
Compare
serialfile: localize os.Open into NewSerialFile
No description provided.