diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2021-11-22 23:25:01 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2021-11-22 23:25:01 +0100 |
commit | ccbbff4774c57c77f66ea64351f7f46bd0db2d9f (patch) | |
tree | 660cf2830f6eda074b86d02c4a99935859454f4d /internal/feed | |
parent | 285fdee712dab96804dcdc1d4fc5dec2508e4abd (diff) | |
download | feed2imap-go-ccbbff4774c57c77f66ea64351f7f46bd0db2d9f.tar.gz feed2imap-go-ccbbff4774c57c77f66ea64351f7f46bd0db2d9f.tar.bz2 feed2imap-go-ccbbff4774c57c77f66ea64351f7f46bd0db2d9f.zip |
Increase go-conformity: map[T]struct{} instead of map[T]bool for sets
Diffstat (limited to '')
-rw-r--r-- | internal/feed/cache/cache.go | 2 | ||||
-rw-r--r-- | internal/feed/cache/state.go | 6 | ||||
-rw-r--r-- | internal/feed/cache/v1.go | 4 | ||||
-rw-r--r-- | internal/feed/cache/v2.go | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/internal/feed/cache/cache.go b/internal/feed/cache/cache.go index 311e871..8029ee0 100644 --- a/internal/feed/cache/cache.go +++ b/internal/feed/cache/cache.go @@ -24,7 +24,7 @@ const ( type Impl interface { cachedFeed(*feed.Feed) CachedFeed transformTo(Version) (Impl, error) - cleanup(knownDescriptors map[feed.Descriptor]bool) + cleanup(knownDescriptors map[feed.Descriptor]struct{}) load(io.Reader) error store(io.Writer) error Version() Version diff --git a/internal/feed/cache/state.go b/internal/feed/cache/state.go index ce6723a..dfdefa1 100644 --- a/internal/feed/cache/state.go +++ b/internal/feed/cache/state.go @@ -11,7 +11,7 @@ import ( type State struct { feeds map[string]*feed.Feed cachedFeeds map[string]CachedFeed - knownFeeds map[feed.Descriptor]bool + knownFeeds map[feed.Descriptor]struct{} cache Cache cfg *config.Config } @@ -56,7 +56,7 @@ func (state *State) LoadCache(fileName string, forceNew bool) error { for name, feed := range state.feeds { state.cachedFeeds[name] = cache.cachedFeed(feed) - state.knownFeeds[feed.Descriptor()] = true + state.knownFeeds[feed.Descriptor()] = struct{}{} } // state.feeds should not be used after loading the cache --> enforce a panic @@ -122,7 +122,7 @@ func NewState(cfg *config.Config) (*State, error) { state := State{ feeds: make(map[string]*feed.Feed, numFeeds), cachedFeeds: make(map[string]CachedFeed, numFeeds), - knownFeeds: make(map[feed.Descriptor]bool, numFeeds), + knownFeeds: make(map[feed.Descriptor]struct{}, numFeeds), cache: Cache{}, // loaded later on cfg: cfg, } diff --git a/internal/feed/cache/v1.go b/internal/feed/cache/v1.go index 5675db5..1c64513 100644 --- a/internal/feed/cache/v1.go +++ b/internal/feed/cache/v1.go @@ -377,9 +377,9 @@ func filterItems(items []cachedItem) []cachedItem { return copiedItems } -func (cache *v1Cache) cleanup(knownDescriptors map[feed.Descriptor]bool) { +func (cache *v1Cache) cleanup(knownDescriptors map[feed.Descriptor]struct{}) { for descr, id := range cache.Ids { - if knownDescriptors[descr] { + if _, ok := knownDescriptors[descr]; ok { // do not delete stuff still known to us continue } diff --git a/internal/feed/cache/v2.go b/internal/feed/cache/v2.go index 2abf2a8..5d6ff9e 100644 --- a/internal/feed/cache/v2.go +++ b/internal/feed/cache/v2.go @@ -29,7 +29,7 @@ func (cache *v2Cache) transformTo(v Version) (Impl, error) { return nil, fmt.Errorf("Transformation not supported") } -func (cache *v2Cache) cleanup(knownDescriptors map[feed.Descriptor]bool) { +func (cache *v2Cache) cleanup(knownDescriptors map[feed.Descriptor]struct{}) { cache.asV1().cleanup(knownDescriptors) } |