diff --git a/commands/compose/send.go b/commands/compose/send.go index 12bf155..dbdb94f 100644 --- a/commands/compose/send.go +++ b/commands/compose/send.go @@ -189,7 +189,7 @@ func newSendmailSender(ctx sendCtx) (io.WriteCloser, error) { return nil, fmt.Errorf("no command specified") } bin := args[0] - rs := make([]string, len(ctx.rcpts), len(ctx.rcpts)) + rs := make([]string, len(ctx.rcpts)) for i := range ctx.rcpts { rs[i] = ctx.rcpts[i].Address } diff --git a/commands/msg/delete.go b/commands/msg/delete.go index 34eac72..5eb622d 100644 --- a/commands/msg/delete.go +++ b/commands/msg/delete.go @@ -88,15 +88,14 @@ func findNextNonDeleted(deleted []uint32, store *lib.MessageStore) *models.Messa if !contains(deleted, selected.Uid) { return selected } - for { - store.Next() - next := store.Selected() - if next == selected || next == nil { - // the last message is in the deleted state or doesn't exist - return nil - } - return next + + store.Next() + next := store.Selected() + if next == selected || next == nil { + // the last message is in the deleted state or doesn't exist + return nil } + return next } func contains(uids []uint32, uid uint32) bool { diff --git a/commands/msg/reply.go b/commands/msg/reply.go index c3ab202..30b09b6 100644 --- a/commands/msg/reply.go +++ b/commands/msg/reply.go @@ -122,7 +122,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { } } if len(to) == 0 { - to = append(msg.Envelope.To) + to = msg.Envelope.To } } diff --git a/commands/msgview/open.go b/commands/msgview/open.go index bcfe2b4..5b19912 100644 --- a/commands/msgview/open.go +++ b/commands/msgview/open.go @@ -37,7 +37,7 @@ func (Open) Execute(aerc *widgets.Aerc, args []string) error { if part, err := p.Msg.BodyStructure.PartAtIndex(p.Index); err == nil { mimeType := fmt.Sprintf("%s/%s", part.MIMEType, part.MIMESubType) - if exts, _ := mime.ExtensionsByType(mimeType); exts != nil && len(exts) > 0 { + if exts, _ := mime.ExtensionsByType(mimeType); len(exts) > 0 { extension = exts[0] } } diff --git a/commands/msgview/save.go b/commands/msgview/save.go index 713c6d1..26a6bf2 100644 --- a/commands/msgview/save.go +++ b/commands/msgview/save.go @@ -151,10 +151,8 @@ func isDirExists(path string) bool { //pathExists returns true if path exists func pathExists(path string) bool { _, err := os.Stat(path) - if err != nil { - return false // we don't really care why it failed - } - return true + + return err == nil } //isAbsPath returns true if path given is anchored to / or . or ~ diff --git a/lib/msgstore.go b/lib/msgstore.go index bd9e935..5a86d41 100644 --- a/lib/msgstore.go +++ b/lib/msgstore.go @@ -575,7 +575,7 @@ func (store *MessageStore) updateVisual() { } missing := make([]uint32, 0) for _, uid := range visUids { - if msg, _ := store.Messages[uid]; msg == nil { + if msg := store.Messages[uid]; msg == nil { missing = append(missing, uid) } } diff --git a/lib/socket.go b/lib/socket.go index 119ffda..814dce1 100644 --- a/lib/socket.go +++ b/lib/socket.go @@ -83,7 +83,7 @@ func (as *AercServer) handleClient(conn net.Conn) { if err != nil { conn.Write([]byte(fmt.Sprintf("result: %v\n", err))) } else { - conn.Write([]byte(fmt.Sprint("result: success\n"))) + conn.Write([]byte("result: success\n")) } } } diff --git a/widgets/aerc.go b/widgets/aerc.go index 98bc1b2..8061f38 100644 --- a/widgets/aerc.go +++ b/widgets/aerc.go @@ -598,13 +598,11 @@ func (aerc *Aerc) AddDialog(d ui.DrawableInteractive) { aerc.Invalidate() }) aerc.Invalidate() - return } func (aerc *Aerc) CloseDialog() { aerc.dialog = nil aerc.Invalidate() - return } func (aerc *Aerc) GetPassword(title string, prompt string) (chText chan string, chErr chan error) { @@ -622,7 +620,6 @@ func (aerc *Aerc) GetPassword(title string, prompt string) (chText chan string, } chErr <- nil chText <- pw - return }) aerc.AddDialog(getPasswd) diff --git a/widgets/compose.go b/widgets/compose.go index e47aa3e..977c4c4 100644 --- a/widgets/compose.go +++ b/widgets/compose.go @@ -876,7 +876,6 @@ func (he *headerEditor) storeValue() { // fix the issue he.header.SetText(he.name, val) } - val = format.FormatAddresses(list) default: he.header.SetText(he.name, val) } diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go index dba2bc6..da81ec9 100644 --- a/widgets/msgviewer.go +++ b/widgets/msgviewer.go @@ -54,10 +54,7 @@ func NewMessageViewer(acct *AccountView, hf := HeaderLayoutFilter{ layout: HeaderLayout(conf.Viewer.HeaderLayout), keep: func(msg *models.MessageInfo, header string) bool { - if fmtHeader(msg, header, "2") != "" { - return true - } - return false + return fmtHeader(msg, header, "2") != "" }, } layout := hf.forMessage(msg.MessageInfo()) diff --git a/widgets/terminal.go b/widgets/terminal.go index b6e8fc0..a9c7988 100644 --- a/widgets/terminal.go +++ b/widgets/terminal.go @@ -134,7 +134,7 @@ func NewTerminal(cmd *exec.Cmd) (*Terminal, error) { return } term.writeMutex.Lock() - n, err = term.vterm.Write(buf[:n]) + _, err = term.vterm.Write(buf[:n]) term.writeMutex.Unlock() if err != nil { term.Close(err) @@ -166,7 +166,7 @@ func (term *Terminal) flushTerminal() { if n == 0 { break } - n, err = term.pty.Write(buf[:n]) + _, err = term.pty.Write(buf[:n]) if err != nil { term.Close(err) return