From 12e4af7b3b73cbcbbd2f0adfea456db540743cf2 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Fri, 8 May 2020 00:03:14 +0200 Subject: Print item hashes in debug mode --- internal/feed/cache_v1.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'internal') 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) { -- cgit v1.2.3-54-g00ecf