in linter/main.go [291:307]
func unmarshalJobFile(gitRoot, filePath string, jobConfig *config.JobConfig) (*UnmarshaledJobConfig, error, error) {
absoluteFilePath := filepath.Join(gitRoot, filePath)
if _, err := os.Stat(absoluteFilePath); os.IsNotExist(err) {
return nil, nil, nil
}
unmarshaledJobConfig := new(UnmarshaledJobConfig)
unmarshaledJobConfig.GithubRepo = strings.Replace(filepath.Dir(filePath), "jobs/", "", 1)
unmarshaledJobConfig.FileName = filepath.Base(filePath)
fileContents, fileReadError := ioutil.ReadFile(absoluteFilePath)
unmarshaledJobConfig.FileContents = string(fileContents)
fileUnmarshalError := yaml.Unmarshal(fileContents, &jobConfig)
unmarshaledJobConfig.ProwjobConfig = jobConfig
return unmarshaledJobConfig, fileReadError, fileUnmarshalError
}