style: use utils.SliceConvert uniformly

This commit is contained in:
Noah Hsu
2022-09-05 00:26:04 +08:00
parent 25ae1b8397
commit 3416861cab
8 changed files with 21 additions and 33 deletions

View File

@ -45,11 +45,9 @@ func (d *GoogleDrive) List(ctx context.Context, dir model.Obj, args model.ListAr
if err != nil {
return nil, err
}
objs := make([]model.Obj, len(files))
for i := 0; i < len(files); i++ {
objs[i] = fileToObj(files[i])
}
return objs, nil
return utils.SliceConvert(files, func(src File) (model.Obj, error) {
return fileToObj(src), nil
})
}
//func (d *GoogleDrive) Get(ctx context.Context, path string) (model.Obj, error) {