aboutsummaryrefslogtreecommitdiff
path: root/filesystem
diff options
context:
space:
mode:
authorVivek V <iamvivekv1996@yahoo.in>2019-10-25 13:47:33 +0530
committerJoseph Richey <joerichey@google.com>2019-10-25 01:17:33 -0700
commit5d888ac2c654a3ac00cd4b608cba0ca1dce47678 (patch)
tree90ab6aa4581f7b76f5c1dbcbb98f8054e2a0b2c0 /filesystem
parenta5b805f03d5add8a1750f564bebf9f6eac035ec1 (diff)
Added capacity to slice creation, when capacity is known (#159)
Simple optimization to reduce memory allocations and copying when appending.
Diffstat (limited to 'filesystem')
-rw-r--r--filesystem/filesystem.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index a11f908..ee332c8 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -528,7 +528,7 @@ func (m *Mount) listDirectory(directoryPath string) ([]string, error) {
return nil, err
}
- var descriptors []string
+ descriptors := make([]string, 0, len(names))
for _, name := range names {
// Be sure to include links as well
descriptors = append(descriptors, strings.TrimSuffix(name, linkFileExtension))