func writesheet(project *lair.Project, outfile string) { header := []string{ "#", "Title", "CVSS", "Rating", "Description", "Evidence", "Solution", "CVEs", "References", "Host", "Hostname(s)", "Port", "Service Note", "Issue Note(s)", } var file *xlsx.File var sheet *xlsx.Sheet var row *xlsx.Row var cell *xlsx.Cell file = xlsx.NewFile() sheet, err := file.AddSheet(project.Name) if err != nil { log.Printf(err.Error()) } row = sheet.AddRow() for _, h := range header { cell = row.AddCell() cell.Value = h } for count, issue := range project.Issues { var issuenote string for _, note := range issue.Notes { issuenote += note.Title issuenote += note.Content + "\n" } for _, host := range issue.Hosts { var refs []string for _, ref := range issue.References { refs = append(refs, ref.Link) } row = sheet.AddRow() cell = row.AddCell() cell.SetInt(count + 1) cell = row.AddCell() cell.Value = issue.Title cell = row.AddCell() cell.SetFloat(issue.CVSS) cell = row.AddCell() cell.Value = issue.Rating cell = row.AddCell() cell.Value = issue.Description cell = row.AddCell() cell.Value = issue.Evidence cell = row.AddCell() cell.Value = issue.Solution cell = row.AddCell() cell.Value = strings.Join(issue.CVEs, "\n") cell = row.AddCell() cell.Value = strings.Join(refs, "\n") cell = row.AddCell() cell.Value = host.IPv4 cell = row.AddCell() cell.Value = gethostname(host.IPv4, &project.Hosts) cell = row.AddCell() cell.SetInt(host.Port) cell = row.AddCell() cell.Value = getcomment(&project.Hosts, issue.Title, host.IPv4, host.Port) cell = row.AddCell() cell.Value = issuenote } } err = file.Save(outfile) if err != nil { log.Fatal("Fatal: Unable to write file") } }