fix golangci-lint warning (#33)
This commit is contained in:
@@ -90,7 +90,7 @@ func (td *TaskDetailPane) Export() {
|
||||
}
|
||||
content.WriteString("\n" + td.task.Details + " \n")
|
||||
|
||||
clipboard.WriteAll(content.String())
|
||||
_ = clipboard.WriteAll(content.String())
|
||||
app.SetFocus(td)
|
||||
statusBar.showForSeconds("Task copyed. Try Pasting anywhere.", 5)
|
||||
}
|
||||
|
||||
@@ -148,21 +148,21 @@ func (pane *TaskPane) LoadDynamicList(logic string) {
|
||||
switch logic {
|
||||
case "today":
|
||||
tasks, err = pane.taskRepo.GetAllByDateRange(zeroTime, today)
|
||||
rangeDesc = fmt.Sprintf("Today (and overdue)")
|
||||
rangeDesc = "Today (and overdue)"
|
||||
|
||||
case "tomorrow":
|
||||
tomorrow := today.AddDate(0, 0, 1)
|
||||
tasks, err = pane.taskRepo.GetAllByDate(tomorrow)
|
||||
rangeDesc = fmt.Sprintf("Tomorrow")
|
||||
rangeDesc = "Tomorrow"
|
||||
|
||||
case "upcoming":
|
||||
week := today.Add(7 * 24 * time.Hour)
|
||||
tasks, err = pane.taskRepo.GetAllByDateRange(today, week)
|
||||
rangeDesc = fmt.Sprintf("Upcoming (next 7 days)")
|
||||
rangeDesc = "Upcoming (next 7 days)"
|
||||
|
||||
case "unscheduled":
|
||||
tasks, err = pane.taskRepo.GetAllByDate(zeroTime)
|
||||
rangeDesc = fmt.Sprintf("Unscheduled (task with no due date) ")
|
||||
rangeDesc = "Unscheduled (task with no due date) "
|
||||
}
|
||||
|
||||
projectPane.activeProject = nil
|
||||
|
||||
29
app/util.go
29
app/util.go
@@ -67,10 +67,11 @@ func ignoreKeyEvt() bool {
|
||||
}
|
||||
|
||||
// yetToImplement - to use as callback for unimplemented features
|
||||
func yetToImplement(feature string) func() {
|
||||
message := fmt.Sprintf("[yellow]%s is yet to implement. Please Check in next version.", feature)
|
||||
return func() { statusBar.showForSeconds(message, 5) }
|
||||
}
|
||||
// `yetToImplement` is unused (deadcode)
|
||||
// func yetToImplement(feature string) func() {
|
||||
// message := fmt.Sprintf("[yellow]%s is yet to implement. Please Check in next version.", feature)
|
||||
// return func() { statusBar.showForSeconds(message, 5) }
|
||||
// }
|
||||
|
||||
func removeThirdCol() {
|
||||
contents.RemoveItem(taskDetailPane)
|
||||
@@ -83,8 +84,7 @@ func getTaskTitleColor(task model.Task) string {
|
||||
if task.Completed {
|
||||
colorName = "green"
|
||||
} else if task.DueDate != 0 {
|
||||
dayDiff := int(time.Unix(task.DueDate, 0).Sub(time.Now()).Hours() / 24)
|
||||
|
||||
dayDiff := int(time.Until(time.Unix(task.DueDate, 0)).Hours() / 24)
|
||||
if dayDiff == 0 {
|
||||
colorName = "orange"
|
||||
} else if dayDiff < 0 {
|
||||
@@ -111,12 +111,13 @@ func makeTaskListingTitle(task model.Task) string {
|
||||
return fmt.Sprintf("[%s]%s %s%s", getTaskTitleColor(task), checkbox, prefix, task.Title)
|
||||
}
|
||||
|
||||
func findProjectByID(id int64) *model.Project {
|
||||
for i := range projectPane.projects {
|
||||
if projectPane.projects[i].ID == id {
|
||||
return &projectPane.projects[i]
|
||||
}
|
||||
}
|
||||
// `findProjectByID` is unused (deadcode)
|
||||
// func findProjectByID(id int64) *model.Project {
|
||||
// for i := range projectPane.projects {
|
||||
// if projectPane.projects[i].ID == id {
|
||||
// return &projectPane.projects[i]
|
||||
// }
|
||||
// }
|
||||
|
||||
return nil
|
||||
}
|
||||
// return nil
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user