mirror of https://github.com/databricks/cli.git
preallocate array
This commit is contained in:
parent
8a9175e332
commit
7c46b35597
|
@ -143,14 +143,14 @@ func (w *WorkspaceFilesClient) ReadDir(ctx context.Context, name string) ([]File
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := make([]FileInfo, 0)
|
info := make([]FileInfo, len(objects))
|
||||||
for _, i := range objects {
|
for i, v := range objects {
|
||||||
info = append(info, FileInfo{
|
info[i] = FileInfo{
|
||||||
Type: string(i.ObjectType),
|
Type: string(v.ObjectType),
|
||||||
Name: path.Base(i.Path),
|
Name: path.Base(v.Path),
|
||||||
Size: i.Size,
|
Size: v.Size,
|
||||||
ModTime: time.UnixMilli(i.ModifiedAt),
|
ModTime: time.UnixMilli(v.ModifiedAt),
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
return info, nil
|
return info, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue