Skip to content

Commit 21c44e4

Browse files
committed
fix lint-go: check return value of sw.SetRow
1 parent f790db9 commit 21c44e4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

services/export/excel.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@ func IssuesToExcel(ctx *context.Context, issues issues_model.IssueList) *exceliz
2424
log.Error("cannot get first cell: %v", err)
2525
return f
2626
}
27-
sw.SetRow(cell, []interface{}{
27+
err := sw.SetRow(cell, []interface{}{
2828
excelize.Cell{Value: "ID"},
2929
excelize.Cell{Value: "Title"},
3030
excelize.Cell{Value: "Status"},
3131
excelize.Cell{Value: "Assignee(s)"},
3232
excelize.Cell{Value: "Label(s)"},
3333
excelize.Cell{Value: "Created At"},
3434
})
35+
if err != nil {
36+
log.Error("cannot SetRow for header: %v", err)
37+
return f
38+
}
3539

3640
// built-in format ID 22 ("m/d/yy h:mm")
3741
datetimeStyleID, err := f.NewStyle(&excelize.Style{NumFmt: 22})
@@ -70,14 +74,18 @@ func IssuesToExcel(ctx *context.Context, issues issues_model.IssueList) *exceliz
7074
}
7175

7276
cell, _ := excelize.CoordinatesToCellName(1, i+1)
73-
sw.SetRow(cell, []interface{}{
77+
err := sw.SetRow(cell, []interface{}{
7478
excelize.Cell{Value: issue.Index},
7579
excelize.Cell{Value: issue.Title},
7680
excelize.Cell{Value: issue.State()},
7781
excelize.Cell{Value: assignees},
7882
excelize.Cell{Value: labels},
7983
excelize.Cell{StyleID: datetimeStyleID, Value: issue.CreatedUnix.AsTime()},
8084
})
85+
if err != nil {
86+
log.Error("cannot SetRow: %v", err)
87+
return f
88+
}
8189

8290
}
8391

0 commit comments

Comments
 (0)