lint: homogenize operations and minor fixes (gocritic)

Apply GoDoc comment policy (comments for humans should have a space
after the //; machine-readable comments shouldn't)

Use strings.ReplaceAll instead of strings.Replace when appropriate

Remove if/else chains by replacing them with switches

Use short assignment/increment notation

Replace single case switches with if statements

Combine else and if when appropriate

Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Moritz Poldrack 2022-07-31 14:32:48 +02:00 committed by Robin Jarry
parent c882cf9960
commit 978d35d356
52 changed files with 231 additions and 256 deletions
lib/format

View file

@ -298,11 +298,12 @@ func ParseMessageFormat(format string, timeFmt string, thisDayTimeFmt string,
recent := false
answered := false
for _, flag := range ctx.MsgInfo.Flags {
if flag == models.SeenFlag {
switch flag {
case models.SeenFlag:
seen = true
} else if flag == models.RecentFlag {
case models.RecentFlag:
recent = true
} else if flag == models.AnsweredFlag {
case models.AnsweredFlag:
answered = true
}
if flag == models.DeletedFlag {