1
0
mirror of https://github.com/golang/go synced 2024-11-23 17:00:07 -07:00

os: avoid a string concat in readdir

R=golang-dev, crawshaw
CC=golang-dev
https://golang.org/cl/37690045
This commit is contained in:
Brad Fitzpatrick 2013-12-17 12:25:32 -08:00
parent 6a1a2170bc
commit ff8e45828c

View File

@ -160,11 +160,10 @@ func (f *File) readdir(n int) (fi []FileInfo, err error) {
if dirname == "" {
dirname = "."
}
dirname += "/"
names, err := f.Readdirnames(n)
fi = make([]FileInfo, 0, len(names))
for _, filename := range names {
fip, lerr := lstat(dirname + filename)
fip, lerr := lstat(dirname + "/" + filename)
if IsNotExist(lerr) {
// File disappeared between readdir + stat.
// Just treat it as if it didn't exist.