aboutsummaryrefslogtreecommitdiff
path: root/internal/feed
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-08 00:03:14 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-08 00:03:14 +0200
commit12e4af7b3b73cbcbbd2f0adfea456db540743cf2 (patch)
tree23aa59cbeb1983f42c3ea440e3aa62bff1d8a5cd /internal/feed
parent0532548c8abf170aaf0abddab67561d2c499863a (diff)
downloadfeed2imap-go-12e4af7b3b73cbcbbd2f0adfea456db540743cf2.tar.gz
feed2imap-go-12e4af7b3b73cbcbbd2f0adfea456db540743cf2.tar.bz2
feed2imap-go-12e4af7b3b73cbcbbd2f0adfea456db540743cf2.zip
Print item hashes in debug mode
Diffstat (limited to 'internal/feed')
-rw-r--r--internal/feed/cache_v1.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/feed/cache_v1.go b/internal/feed/cache_v1.go
index d515528..157741f 100644
--- a/internal/feed/cache_v1.go
+++ b/internal/feed/cache_v1.go
@@ -2,6 +2,7 @@ package feed
import (
"crypto/sha256"
+ "encoding/hex"
"fmt"
"strconv"
"time"
@@ -40,6 +41,10 @@ type cachedFeed struct {
type itemHash [sha256.Size]byte
+func (h itemHash) String() string {
+ return hex.EncodeToString(h[:])
+}
+
type cachedItem struct {
Guid string
Title string
@@ -56,7 +61,8 @@ func (item cachedItem) String() string {
Guid: %q
Link: %q
Date: %s
-}`, item.Title, item.Guid, item.Link, util.TimeFormat(item.Date))
+ Hash: %s
+}`, item.Title, item.Guid, item.Link, util.TimeFormat(item.Date), item.Hash)
}
func (cf *cachedFeed) Checked(withFailure bool) {