aboutsummaryrefslogtreecommitdiffstats
path: root/worker/lib
diff options
context:
space:
mode:
authorMoritz Poldrack <git@moritz.sh>2022-07-31 22:16:40 +0200
committerRobin Jarry <robin@jarry.cc>2022-08-01 10:44:52 +0200
commitaaf0a0c65673db4b94c0dc200d7394a192128da1 (patch)
tree44940936efff55b49a6d359d053f55c7ab824e4d /worker/lib
parent21dcd440f877192af128c00ca2acbabf68bb3ee3 (diff)
downloadaerc-aaf0a0c65673db4b94c0dc200d7394a192128da1.tar.gz
lint: apply new formatting rules
Run `make fmt`. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker/lib')
-rw-r--r--worker/lib/parse.go4
-rw-r--r--worker/lib/search.go4
-rw-r--r--worker/lib/sort.go12
3 files changed, 12 insertions, 8 deletions
diff --git a/worker/lib/parse.go b/worker/lib/parse.go
index bdd927f9..d92eeda7 100644
--- a/worker/lib/parse.go
+++ b/worker/lib/parse.go
@@ -46,7 +46,7 @@ func FetchEntityPartReader(e *message.Entity, index []int) (io.Reader, error) {
return nil, fmt.Errorf("FetchEntityPartReader: unexpected code reached")
}
-//TODO: the UI doesn't seem to like readers which aren't buffers
+// TODO: the UI doesn't seem to like readers which aren't buffers
func bufReader(e *message.Entity) (io.Reader, error) {
var buf bytes.Buffer
if _, err := io.Copy(&buf, e.Body); err != nil {
@@ -157,7 +157,7 @@ func parseEnvelope(h *mail.Header) (*models.Envelope, error) {
}
msgID, err := h.MessageID()
if err != nil {
- //proper parsing failed, so fall back to whatever is there
+ // proper parsing failed, so fall back to whatever is there
msgID, err = h.Text("message-id")
if err != nil {
return nil, err
diff --git a/worker/lib/search.go b/worker/lib/search.go
index c7d3bee7..dc29a66f 100644
--- a/worker/lib/search.go
+++ b/worker/lib/search.go
@@ -97,8 +97,8 @@ func Search(messages []RawMessage, criteria *searchCriteria) ([]uint32, error) {
// searchMessage executes the search criteria for the given RawMessage,
// returns true if search succeeded
func searchMessage(message RawMessage, criteria *searchCriteria,
- parts MsgParts) (bool, error) {
-
+ parts MsgParts,
+) (bool, error) {
// setup parts of the message to use in the search
// this is so that we try to minimise reading unnecessary parts
var (
diff --git a/worker/lib/sort.go b/worker/lib/sort.go
index 958cbed7..3bfd7d41 100644
--- a/worker/lib/sort.go
+++ b/worker/lib/sort.go
@@ -10,7 +10,8 @@ import (
)
func Sort(messageInfos []*models.MessageInfo,
- criteria []*types.SortCriterion) ([]uint32, error) {
+ criteria []*types.SortCriterion,
+) ([]uint32, error) {
// loop through in reverse to ensure we sort by non-primary fields first
for i := len(criteria) - 1; i >= 0; i-- {
criterion := criteria[i]
@@ -62,7 +63,8 @@ func Sort(messageInfos []*models.MessageInfo,
}
func sortAddresses(messageInfos []*models.MessageInfo, criterion *types.SortCriterion,
- getValue func(*models.MessageInfo) []*mail.Address) {
+ getValue func(*models.MessageInfo) []*mail.Address,
+) {
sortSlice(criterion, messageInfos, func(i, j int) bool {
addressI, addressJ := getValue(messageInfos[i]), getValue(messageInfos[j])
var firstI, firstJ *mail.Address
@@ -92,7 +94,8 @@ func sortAddresses(messageInfos []*models.MessageInfo, criterion *types.SortCrit
}
func sortFlags(messageInfos []*models.MessageInfo, criterion *types.SortCriterion,
- testFlag models.Flag) {
+ testFlag models.Flag,
+) {
var slice []*boolStore
for _, msgInfo := range messageInfos {
flagPresent := false
@@ -116,7 +119,8 @@ func sortFlags(messageInfos []*models.MessageInfo, criterion *types.SortCriterio
}
func sortStrings(messageInfos []*models.MessageInfo, criterion *types.SortCriterion,
- getValue func(*models.MessageInfo) string) {
+ getValue func(*models.MessageInfo) string,
+) {
var slice []*lexiStore
for _, msgInfo := range messageInfos {
slice = append(slice, &lexiStore{