diff options
author | Moritz Poldrack <git@moritz.sh> | 2022-07-31 22:16:40 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-08-01 10:44:52 +0200 |
commit | aaf0a0c65673db4b94c0dc200d7394a192128da1 (patch) | |
tree | 44940936efff55b49a6d359d053f55c7ab824e4d /worker/types | |
parent | 21dcd440f877192af128c00ca2acbabf68bb3ee3 (diff) | |
download | aerc-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/types')
-rw-r--r-- | worker/types/thread.go | 4 | ||||
-rw-r--r-- | worker/types/thread_test.go | 2 | ||||
-rw-r--r-- | worker/types/worker.go | 5 |
3 files changed, 6 insertions, 5 deletions
diff --git a/worker/types/thread.go b/worker/types/thread.go index 7c0cc5b8..705b3e4e 100644 --- a/worker/types/thread.go +++ b/worker/types/thread.go @@ -94,7 +94,7 @@ var ErrSkipThread = errors.New("skip this Thread") type NewThreadWalkFn func(t *Thread, level int, currentErr error) error -//Implement interface to be able to sort threads by newest (max UID) +// Implement interface to be able to sort threads by newest (max UID) type ByUID []*Thread func getMaxUID(thread *Thread) uint32 { @@ -113,9 +113,11 @@ func getMaxUID(thread *Thread) uint32 { func (s ByUID) Len() int { return len(s) } + func (s ByUID) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + func (s ByUID) Less(i, j int) bool { maxUID_i := getMaxUID(s[i]) maxUID_j := getMaxUID(s[j]) diff --git a/worker/types/thread_test.go b/worker/types/thread_test.go index e79dddd1..803f7ba9 100644 --- a/worker/types/thread_test.go +++ b/worker/types/thread_test.go @@ -85,7 +85,7 @@ func TestNewWalk(t *testing.T) { prefix = append(prefix, " ") } } else if lvl < lastLevel { - //ascended, need to trim the prefix layers + // ascended, need to trim the prefix layers diff := lastLevel - lvl prefix = prefix[:len(prefix)-diff] } diff --git a/worker/types/worker.go b/worker/types/worker.go index 8f179df6..9e247982 100644 --- a/worker/types/worker.go +++ b/worker/types/worker.go @@ -36,7 +36,6 @@ func (worker *Worker) setId(msg WorkerMessage) { } func (worker *Worker) PostAction(msg WorkerMessage, cb func(msg WorkerMessage)) { - worker.setId(msg) if resp := msg.InResponseTo(); resp != nil { @@ -52,8 +51,8 @@ func (worker *Worker) PostAction(msg WorkerMessage, cb func(msg WorkerMessage)) } func (worker *Worker) PostMessage(msg WorkerMessage, - cb func(msg WorkerMessage)) { - + cb func(msg WorkerMessage), +) { worker.setId(msg) if resp := msg.InResponseTo(); resp != nil { |