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: job.go
    path of file: ./repos/merlin/pkg/services/job
    
    the code of the file until where you have to start completion: /*
Merlin is a post-exploitation command and control framework.

This file is part of Merlin.
Copyright (C) 2023 Russel Van Tuyl

Merlin is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.

Merlin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public
    
func (s *Service) checkJob(job jobs.Job) error {
	// Check to make sure agent UUID is in dataset
	if !s.agentService.Exist(job.AgentID) {
		return fmt.Errorf("job %s was for an invalid agent %s", job.ID, job.AgentID)
	}
	j, err := s.jobRepo.GetInfo(job.ID)
	if err != nil {
		return fmt.Errorf("pkg/services/job.checkJob: %s", err)
	}

	if job.Token != j.Token() {
		return fmt.Errorf("job %s for agent %s did not contain the correct token. Expected: %s, Got: %s", job.ID, job.AgentID, j.Token(), job.Token)
	}
	if j.Status() == infoJobs.COMPLETE {
		return fmt.Errorf("job %s for agent %s was previously completed on %s", job.ID, job.AgentID, j.Completed())
	}
	if j.Status() == infoJobs.CANCELED {
		return fmt.Errorf("job %s for agent %s was previously canceled on", job.ID, job.AgentID)
	}
	return nil
}