aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-26 17:31:33 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-26 17:31:33 +0200
commit835d5f3547f10ede1997a938d9278a506a089bb7 (patch)
tree8bf73e9a068d1ebacc2fe8888e708dd7ac7ae0c1 /internal
parent7ed48c710d1c95b74d3da60d55a4c30a30400617 (diff)
downloadfeed2imap-go-835d5f3547f10ede1997a938d9278a506a089bb7.tar.gz
feed2imap-go-835d5f3547f10ede1997a938d9278a506a089bb7.tar.bz2
feed2imap-go-835d5f3547f10ede1997a938d9278a506a089bb7.zip
Some linting remarks
Diffstat (limited to '')
-rw-r--r--internal/imap/cmds.go1
-rw-r--r--internal/imap/commando.go4
-rw-r--r--internal/imap/connection.go4
-rw-r--r--internal/imap/imap.go15
4 files changed, 13 insertions, 11 deletions
diff --git a/internal/imap/cmds.go b/internal/imap/cmds.go
index 499d6c0..d978d80 100644
--- a/internal/imap/cmds.go
+++ b/internal/imap/cmds.go
@@ -12,7 +12,6 @@ func (client *Client) EnsureFolder(folder Folder) error {
return client.commander.execute(ensureCommando{folder})
}
-
type addCommando struct {
folder Folder
messages []string
diff --git a/internal/imap/commando.go b/internal/imap/commando.go
index 1cf688e..348c724 100644
--- a/internal/imap/commando.go
+++ b/internal/imap/commando.go
@@ -13,8 +13,8 @@ type command interface {
}
type execution struct {
- cmd command
- done chan<- error
+ cmd command
+ done chan<- error
}
func (commander *commander) execute(command command) error {
diff --git a/internal/imap/connection.go b/internal/imap/connection.go
index 4d209a9..5f62586 100644
--- a/internal/imap/connection.go
+++ b/internal/imap/connection.go
@@ -102,10 +102,10 @@ func (conn *connection) ensureFolder(folder Folder) error {
if conn.mailboxes.locking(folder) {
// someone else tried to create the MB -- try again, now that he's done
return conn.ensureFolder(folder)
- } else {
- defer conn.mailboxes.unlocking(folder)
}
+ defer conn.mailboxes.unlocking(folder)
+
log.Printf("Checking for folder '%s'", folder)
mbox, found, err := conn.list(folder.str)
diff --git a/internal/imap/imap.go b/internal/imap/imap.go
index 8f4c50e..f8c8632 100644
--- a/internal/imap/imap.go
+++ b/internal/imap/imap.go
@@ -11,20 +11,23 @@ import (
)
func newImapClient(url *URL, forceTls bool) (*imapClient.Client, error) {
+ var (
+ c *imapClient.Client
+ err error
+ )
+
if forceTls {
- c, err := imapClient.DialTLS(url.Host, nil)
- if err != nil {
+ if c, err = imapClient.DialTLS(url.Host, nil); err != nil {
return nil, fmt.Errorf("connecting (TLS) to %s: %w", url.Host, err)
}
log.Print("Connected to ", url.Host, " (TLS)")
- return c, nil
} else {
- c, err := imapClient.Dial(url.Host)
- if err != nil {
+ if c, err = imapClient.Dial(url.Host); err != nil {
return nil, fmt.Errorf("connecting to %s: %w", url.Host, err)
}
- return c, nil
}
+
+ return c, nil
}
func (client *Client) connect(url *URL, forceTls bool) (*connection, error) {