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:
parent
c882cf9960
commit
978d35d356
52 changed files with 231 additions and 256 deletions
worker/maildir
|
@ -80,7 +80,7 @@ func (c *Container) ListFolders() ([]string, error) {
|
|||
return filepath.SkipDir
|
||||
}
|
||||
dirPath = strings.TrimPrefix(dirPath, ".")
|
||||
dirPath = strings.Replace(dirPath, ".", "/", -1)
|
||||
dirPath = strings.ReplaceAll(dirPath, ".", "/")
|
||||
folders = append(folders, dirPath)
|
||||
|
||||
// Since all mailboxes are stored in a single directory, don't
|
||||
|
@ -124,7 +124,7 @@ func (c *Container) Dir(name string) maildir.Dir {
|
|||
if name == "INBOX" {
|
||||
return maildir.Dir(c.dir)
|
||||
}
|
||||
return maildir.Dir(filepath.Join(c.dir, "."+strings.Replace(name, "/", ".", -1)))
|
||||
return maildir.Dir(filepath.Join(c.dir, "."+strings.ReplaceAll(name, "/", ".")))
|
||||
}
|
||||
return maildir.Dir(filepath.Join(c.dir, name))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue