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: garbageUtil.go
    path of file: ./repos/databag/net/server/internal
    
    the code of the file until where you have to start completion: package databag

import (
	"databag/internal/store"
	"os"
	"sync"
)

var garbageSync sync.M
    
func garbageCollect(act *store.Account) {
	garbageSync.Lock()
	defer garbageSync.Unlock()

	// get all asset files
	dir := getStrConfigValue(CNFAssetPath, APPDefaultPath) + "/" + act.GUID
	files, err := os.ReadDir(dir)
	if err != nil {
		ErrMsg(err)
		return
	}

	// create map of all files
	list := make(map[string]bool)
	for _, file := range files {
		list[file.Name()] = false
	}

	// get all asset records
	var assets []store.Asset
	if err := store.DB.Where("account_id = ?", act.ID).Find(&assets).Error; err != nil {
		ErrMsg(err)
		return
	}

	// mark all referenced files
	for _, asset := range assets {
		list[asset.AssetID] = true
	}

	// delete any unreferenced file
	for id, set := range list {
		if !set {
			LogMsg("removing file asset " + act.GUID + "/" + id)
			if err := os.Remove(dir + "/" + id); err != nil {
				ErrMsg(err)
			}
		}
	}
}