From 79d3c2bfd95c5cb0ac6e4a3f97156161d792c676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sun, 24 Apr 2022 18:53:32 +0200 Subject: Replace `interface{}` by `any` --- internal/feed/cache/cache.go | 2 +- internal/feed/cache/v1.go | 2 +- internal/feed/cache/v2.go | 2 +- internal/feed/item.go | 2 +- internal/feed/template/funcs.go | 6 +++--- internal/feed/template/funcs_test.go | 4 ++-- internal/feed/template/template.go | 2 +- internal/imap/connection.go | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) (limited to 'internal') diff --git a/internal/feed/cache/cache.go b/internal/feed/cache/cache.go index 8029ee0..d13ae9a 100644 --- a/internal/feed/cache/cache.go +++ b/internal/feed/cache/cache.go @@ -29,7 +29,7 @@ type Impl interface { store(io.Writer) error Version() Version Info() string - SpecificInfo(interface{}) string + SpecificInfo(any) string } type Cache struct { diff --git a/internal/feed/cache/v1.go b/internal/feed/cache/v1.go index 1c64513..7d0d11b 100644 --- a/internal/feed/cache/v1.go +++ b/internal/feed/cache/v1.go @@ -137,7 +137,7 @@ func (cache *v1Cache) Info() string { return b.String() } -func (cache *v1Cache) SpecificInfo(i interface{}) string { +func (cache *v1Cache) SpecificInfo(i any) string { id := idFromString(i.(string)) b := strings.Builder{} diff --git a/internal/feed/cache/v2.go b/internal/feed/cache/v2.go index 5d6ff9e..aab0f90 100644 --- a/internal/feed/cache/v2.go +++ b/internal/feed/cache/v2.go @@ -41,7 +41,7 @@ func (cache *v2Cache) Info() string { return cache.asV1().Info() } -func (cache *v2Cache) SpecificInfo(i interface{}) string { +func (cache *v2Cache) SpecificInfo(i any) string { return cache.asV1().SpecificInfo(i) } diff --git a/internal/feed/item.go b/internal/feed/item.go index 44e878c..79a971c 100644 --- a/internal/feed/item.go +++ b/internal/feed/item.go @@ -65,7 +65,7 @@ func (item *Item) FeedLink() string { } func (item *Item) AddReason(reason string) { - if !util.StrContains(item.reasons, reason) { + if !util.Contains(item.reasons, reason) { item.reasons = append(item.reasons, reason) } } diff --git a/internal/feed/template/funcs.go b/internal/feed/template/funcs.go index 30a2975..fbfb572 100644 --- a/internal/feed/template/funcs.go +++ b/internal/feed/template/funcs.go @@ -10,8 +10,8 @@ import ( ) // dict creates a map out of the passed in key/value pairs. -func dict(v ...interface{}) map[string]interface{} { - dict := make(map[string]interface{}) +func dict(v ...any) map[string]any { + dict := make(map[string]any) lenv := len(v) for i := 0; i < lenv; i += 2 { key := v[i].(string) @@ -63,7 +63,7 @@ func _html(s string) html.HTML { return html.HTML(s) } -var funcMap = map[string]interface{}{ +var funcMap = map[string]any{ "dict": dict, "join": join, "lastUrlPart": lastUrlPart, diff --git a/internal/feed/template/funcs_test.go b/internal/feed/template/funcs_test.go index c75d27d..a5c25c3 100644 --- a/internal/feed/template/funcs_test.go +++ b/internal/feed/template/funcs_test.go @@ -31,8 +31,8 @@ func TestByteCount(t *testing.T) { } func TestDict(t *testing.T) { - type i []interface{} - type o map[string]interface{} + type i []any + type o map[string]any tests := map[string]struct { inp i diff --git a/internal/feed/template/template.go b/internal/feed/template/template.go index d66a8e4..4f17717 100644 --- a/internal/feed/template/template.go +++ b/internal/feed/template/template.go @@ -14,7 +14,7 @@ import ( ) type template interface { - Execute(wr io.Writer, data interface{}) error + Execute(wr io.Writer, data any) error Name() string } diff --git a/internal/imap/connection.go b/internal/imap/connection.go index b93a61f..8c0f59c 100644 --- a/internal/imap/connection.go +++ b/internal/imap/connection.go @@ -125,7 +125,7 @@ func (conn *connection) ensureFolder(folder Folder) error { } switch { - case found == 0 || (found == 1 && util.StrContains(mbox.Attributes, imap.NoSelectAttr)): + case found == 0 || (found == 1 && util.Contains(mbox.Attributes, imap.NoSelectAttr)): return conn.createFolder(folder.str) case found == 1: conn.mailboxes.add(mbox) @@ -137,7 +137,7 @@ func (conn *connection) ensureFolder(folder Folder) error { func (conn *connection) delete(uids []uint32) error { storeItem := imap.FormatFlagsOp(imap.AddFlags, true) - deleteFlag := []interface{}{imap.DeletedFlag} + deleteFlag := []any{imap.DeletedFlag} seqSet := new(imap.SeqSet) seqSet.AddNum(uids...) -- cgit v1.2.3