You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: downloader.go
    path of file: ./repos/rudder-server/warehouse/internal/service/loadfiles/downloader
    
    the code of the file until where you have to start completion: package downloader

import (
	"context"
	"fmt"
	"os"
	"path/filepath"
	"sync"
	"time"

	"github.com/rudderlabs/rudder-server/warehouse/internal/model"

	"
    
func (l *downloaderImpl) downloadSingleObject(ctx context.Context, fileManager filemanager.FileManager, object warehouseutils.LoadFile) (string, error) {
	var (
		objectName string
		tmpDirPath string
		err        error
		objectFile *os.File
	)

	ObjectStorage := warehouseutils.ObjectStorageType(
		l.warehouse.Destination.DestinationDefinition.Name,
		l.warehouse.Destination.Config,
		l.uploader.UseRudderStorage(),
	)

	if objectName, err = warehouseutils.GetObjectName(object.Location, l.warehouse.Destination.Config, ObjectStorage); err != nil {
		return "", fmt.Errorf("object name for location: %s, %w", object.Location, err)
	}

	dirName := fmt.Sprintf(`/%s/`, misc.RudderWarehouseLoadUploadsTmp)
	if tmpDirPath, err = misc.CreateTMPDIR(); err != nil {
		return "", fmt.Errorf("creating tmp dir: %w", err)
	}

	ObjectPath := tmpDirPath + dirName + fmt.Sprintf(`%s_%s_%d/`, l.warehouse.Destination.DestinationDefinition.Name, l.warehouse.Destination.ID, time.Now().Unix()) + objectName
	if err = os.MkdirAll(filepath.Dir(ObjectPath), os.ModePerm); err != nil {
		return "", fmt.Errorf("making tmp dir: %w", err)
	}

	if objectFile, err = os.Create(ObjectPath); err != nil {
		return "", fmt.Errorf("creating file in tmp dir: %w", err)
	}

	if err = fileManager.Download(ctx, objectFile, objectName); err != nil {
		return "", fmt.Errorf("downloading file from object storage: %w", err)
	}

	if err = objectFile.Close(); err != nil {
		return "", fmt.Errorf("closing downloaded file in tmp directory: %w", err)
	}

	return objectFile.Name(), nil
}