diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2021-02-27 23:29:04 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2021-02-27 23:29:04 +0100 |
commit | 21210173c4d04676436b8e48dfbe4043299797cb (patch) | |
tree | ebd1b27308efd9be3bbc05d7387a2939f920961e /internal/feed/cache/cache.go | |
parent | 8ff43ad01008e8640b2d6f9fd2a56b1c4a78f68f (diff) | |
download | feed2imap-go-21210173c4d04676436b8e48dfbe4043299797cb.tar.gz feed2imap-go-21210173c4d04676436b8e48dfbe4043299797cb.tar.bz2 feed2imap-go-21210173c4d04676436b8e48dfbe4043299797cb.zip |
Do not upgrade the cache in `print-cache`
Diffstat (limited to 'internal/feed/cache/cache.go')
-rw-r--r-- | internal/feed/cache/cache.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/feed/cache/cache.go b/internal/feed/cache/cache.go index 1ea8eaf..171d0cb 100644 --- a/internal/feed/cache/cache.go +++ b/internal/feed/cache/cache.go @@ -138,7 +138,7 @@ func create() (Cache, error) { }, nil } -func Load(fileName string) (Cache, error) { +func Load(fileName string, upgrade bool) (Cache, error) { f, err := os.Open(fileName) if err != nil { if errors.Is(err, os.ErrNotExist) { @@ -171,7 +171,7 @@ func Load(fileName string) (Cache, error) { return Cache{}, fmt.Errorf("decoding for version '%d' from '%s': %w", version, fileName, err) } - if currentVersion != cache.Version() { + if upgrade && currentVersion != cache.Version() { if cache, err = cache.transformTo(currentVersion); err != nil { return Cache{}, fmt.Errorf("cannot transform from version %d to %d: %w", version, currentVersion, err) } |