all: fix minor issues found by staticcheck
Signed-off-by: Moritz Poldrack <git@moritz.sh>
This commit is contained in:
parent
65ae87a524
commit
4bc43d2741
|
@ -189,7 +189,7 @@ func newSendmailSender(ctx sendCtx) (io.WriteCloser, error) {
|
||||||
return nil, fmt.Errorf("no command specified")
|
return nil, fmt.Errorf("no command specified")
|
||||||
}
|
}
|
||||||
bin := args[0]
|
bin := args[0]
|
||||||
rs := make([]string, len(ctx.rcpts), len(ctx.rcpts))
|
rs := make([]string, len(ctx.rcpts))
|
||||||
for i := range ctx.rcpts {
|
for i := range ctx.rcpts {
|
||||||
rs[i] = ctx.rcpts[i].Address
|
rs[i] = ctx.rcpts[i].Address
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ func findNextNonDeleted(deleted []uint32, store *lib.MessageStore) *models.Messa
|
||||||
if !contains(deleted, selected.Uid) {
|
if !contains(deleted, selected.Uid) {
|
||||||
return selected
|
return selected
|
||||||
}
|
}
|
||||||
for {
|
|
||||||
store.Next()
|
store.Next()
|
||||||
next := store.Selected()
|
next := store.Selected()
|
||||||
if next == selected || next == nil {
|
if next == selected || next == nil {
|
||||||
|
@ -97,7 +97,6 @@ func findNextNonDeleted(deleted []uint32, store *lib.MessageStore) *models.Messa
|
||||||
}
|
}
|
||||||
return next
|
return next
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func contains(uids []uint32, uid uint32) bool {
|
func contains(uids []uint32, uid uint32) bool {
|
||||||
for _, item := range uids {
|
for _, item := range uids {
|
||||||
|
|
|
@ -122,7 +122,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(to) == 0 {
|
if len(to) == 0 {
|
||||||
to = append(msg.Envelope.To)
|
to = msg.Envelope.To
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ func (Open) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
if part, err := p.Msg.BodyStructure.PartAtIndex(p.Index); err == nil {
|
if part, err := p.Msg.BodyStructure.PartAtIndex(p.Index); err == nil {
|
||||||
mimeType := fmt.Sprintf("%s/%s", part.MIMEType, part.MIMESubType)
|
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]
|
extension = exts[0]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,10 +151,8 @@ func isDirExists(path string) bool {
|
||||||
//pathExists returns true if path exists
|
//pathExists returns true if path exists
|
||||||
func pathExists(path string) bool {
|
func pathExists(path string) bool {
|
||||||
_, err := os.Stat(path)
|
_, err := os.Stat(path)
|
||||||
if err != nil {
|
|
||||||
return false // we don't really care why it failed
|
return err == nil
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//isAbsPath returns true if path given is anchored to / or . or ~
|
//isAbsPath returns true if path given is anchored to / or . or ~
|
||||||
|
|
|
@ -575,7 +575,7 @@ func (store *MessageStore) updateVisual() {
|
||||||
}
|
}
|
||||||
missing := make([]uint32, 0)
|
missing := make([]uint32, 0)
|
||||||
for _, uid := range visUids {
|
for _, uid := range visUids {
|
||||||
if msg, _ := store.Messages[uid]; msg == nil {
|
if msg := store.Messages[uid]; msg == nil {
|
||||||
missing = append(missing, uid)
|
missing = append(missing, uid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ func (as *AercServer) handleClient(conn net.Conn) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
conn.Write([]byte(fmt.Sprintf("result: %v\n", err)))
|
conn.Write([]byte(fmt.Sprintf("result: %v\n", err)))
|
||||||
} else {
|
} else {
|
||||||
conn.Write([]byte(fmt.Sprint("result: success\n")))
|
conn.Write([]byte("result: success\n"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -598,13 +598,11 @@ func (aerc *Aerc) AddDialog(d ui.DrawableInteractive) {
|
||||||
aerc.Invalidate()
|
aerc.Invalidate()
|
||||||
})
|
})
|
||||||
aerc.Invalidate()
|
aerc.Invalidate()
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (aerc *Aerc) CloseDialog() {
|
func (aerc *Aerc) CloseDialog() {
|
||||||
aerc.dialog = nil
|
aerc.dialog = nil
|
||||||
aerc.Invalidate()
|
aerc.Invalidate()
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (aerc *Aerc) GetPassword(title string, prompt string) (chText chan string, chErr chan error) {
|
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
|
chErr <- nil
|
||||||
chText <- pw
|
chText <- pw
|
||||||
return
|
|
||||||
})
|
})
|
||||||
aerc.AddDialog(getPasswd)
|
aerc.AddDialog(getPasswd)
|
||||||
|
|
||||||
|
|
|
@ -876,7 +876,6 @@ func (he *headerEditor) storeValue() {
|
||||||
// fix the issue
|
// fix the issue
|
||||||
he.header.SetText(he.name, val)
|
he.header.SetText(he.name, val)
|
||||||
}
|
}
|
||||||
val = format.FormatAddresses(list)
|
|
||||||
default:
|
default:
|
||||||
he.header.SetText(he.name, val)
|
he.header.SetText(he.name, val)
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,10 +54,7 @@ func NewMessageViewer(acct *AccountView,
|
||||||
hf := HeaderLayoutFilter{
|
hf := HeaderLayoutFilter{
|
||||||
layout: HeaderLayout(conf.Viewer.HeaderLayout),
|
layout: HeaderLayout(conf.Viewer.HeaderLayout),
|
||||||
keep: func(msg *models.MessageInfo, header string) bool {
|
keep: func(msg *models.MessageInfo, header string) bool {
|
||||||
if fmtHeader(msg, header, "2") != "" {
|
return fmtHeader(msg, header, "2") != ""
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
layout := hf.forMessage(msg.MessageInfo())
|
layout := hf.forMessage(msg.MessageInfo())
|
||||||
|
|
|
@ -134,7 +134,7 @@ func NewTerminal(cmd *exec.Cmd) (*Terminal, error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
term.writeMutex.Lock()
|
term.writeMutex.Lock()
|
||||||
n, err = term.vterm.Write(buf[:n])
|
_, err = term.vterm.Write(buf[:n])
|
||||||
term.writeMutex.Unlock()
|
term.writeMutex.Unlock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
term.Close(err)
|
term.Close(err)
|
||||||
|
@ -166,7 +166,7 @@ func (term *Terminal) flushTerminal() {
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
n, err = term.pty.Write(buf[:n])
|
_, err = term.pty.Write(buf[:n])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
term.Close(err)
|
term.Close(err)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue