diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-04-26 17:44:20 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-04-26 17:44:20 +0200 |
commit | 9e69c102b596924d589693ce537c4fecae3aa44c (patch) | |
tree | bc43276b03f1f92da51e41b48ebe5fa5adb437c7 /main.go | |
parent | 835d5f3547f10ede1997a938d9278a506a089bb7 (diff) | |
download | feed2imap-go-9e69c102b596924d589693ce537c4fecae3aa44c.tar.gz feed2imap-go-9e69c102b596924d589693ce537c4fecae3aa44c.tar.bz2 feed2imap-go-9e69c102b596924d589693ce537c4fecae3aa44c.zip |
Handle the waitGroup internally in ForeachGo
Diffstat (limited to '')
-rw-r--r-- | main.go | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -5,7 +5,6 @@ import ( "fmt" "net/url" "os" - "sync" "github.com/Necoro/feed2imap-go/internal/feed" "github.com/Necoro/feed2imap-go/internal/imap" @@ -18,9 +17,7 @@ var cacheFile = flag.String("c", "feed.cache", "cache file") var verbose = flag.Bool("v", false, "enable verbose output") var debug = flag.Bool("d", false, "enable debug output") -func processFeed(feed *feed.Feed, cfg *config.Config, client *imap.Client, wg *sync.WaitGroup) { - defer wg.Done() - +func processFeed(feed *feed.Feed, cfg *config.Config, client *imap.Client) { mails, err := feed.ToMails(cfg) if err != nil { log.Errorf("Processing items of feed %s: %s", feed.Name, err) @@ -99,8 +96,8 @@ func run() error { defer c.Disconnect() - state.ForeachGo(func(f *feed.Feed, wg *sync.WaitGroup) { - processFeed(f, cfg, c, wg) + state.ForeachGo(func(f *feed.Feed) { + processFeed(f, cfg, c) }) if err = state.StoreCache(*cacheFile); err != nil { |