func detectWorkflows(file *models.File, workflows models.Workflows) { contentType, _ := file.Attributes["content_type"].(string) line, _ := file.Attributes["line"].(string) if err := workflows.DetectWorkflows(contentType, line); err != nil { file.Status = models.HAS_NO_WORKFLOW file.Error = fmt.Sprintf("Could not detect workflows for file: %#v. %s\n", file, err) l.Println(file.Error) } if len(workflows) > 0 { if len(workflows) == 1 { file.Status = models.HAS_WORKFLOW file.Workflow = workflows[0] } else { file.Status = models.HAS_MANY_WORKFLOWS file.Error = fmt.Sprintf("Matched more than one workflow\n: %#v", workflows) l.Println(file.Error) } } else { file.Status = models.HAS_NO_WORKFLOW file.Error = fmt.Sprintf("No workflows matched by content_type %q and line %q", contentType, line) l.Println(file.Error) } }