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: workload.go
    path of file: ./repos/gaia/workers/scheduler/gaiascheduler
    
    the code of the file until where you have to start completion: package gaiascheduler

import (
	"sync"

	"github.com/gaia-pipeline/gaia"
)

// workload is a wrapper around a single job object.
type workload struct {
	finishedSig chan bool
	done        bool
	started     bool
	job         *gaia.Job
}

// managedWorkloads holds
    
func (mw *managedWorkloads) Replace(wl workload) bool {
	mw.Lock()
	defer mw.Unlock()

	// Search for the id
	i := -1
	for id, currWL := range mw.workloads {
		if currWL.job.ID == wl.job.ID {
			i = id
			break
		}
	}

	// We got it?
	if i == -1 {
		return false
	}

	// Yes
	mw.workloads[i] = wl
	return true
}