aboutsummaryrefslogtreecommitdiff
path: root/pkg/config
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2022-04-24 18:53:32 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2022-04-24 18:53:32 +0200
commit79d3c2bfd95c5cb0ac6e4a3f97156161d792c676 (patch)
treecbfd034a362666b8dab842d3afed18cf95124ede /pkg/config
parent7822c9d443458ae9d1d9d678e279bfc516da7a8f (diff)
downloadfeed2imap-go-79d3c2bfd95c5cb0ac6e4a3f97156161d792c676.tar.gz
feed2imap-go-79d3c2bfd95c5cb0ac6e4a3f97156161d792c676.tar.bz2
feed2imap-go-79d3c2bfd95c5cb0ac6e4a3f97156161d792c676.zip
Replace `interface{}` by `any`
Diffstat (limited to 'pkg/config')
-rw-r--r--pkg/config/body.go4
-rw-r--r--pkg/config/config.go6
-rw-r--r--pkg/config/deprecated.go6
3 files changed, 8 insertions, 8 deletions
diff --git a/pkg/config/body.go b/pkg/config/body.go
index 3b2f676..17cf924 100644
--- a/pkg/config/body.go
+++ b/pkg/config/body.go
@@ -22,7 +22,7 @@ func (b *Body) UnmarshalYAML(node *yaml.Node) error {
val = "default"
}
- if !util.StrContains(validBody, val) {
+ if !util.Contains(validBody, val) {
return TypeError("line %d: Invalid value for 'body': %q", node.Line, val)
}
@@ -30,6 +30,6 @@ func (b *Body) UnmarshalYAML(node *yaml.Node) error {
return nil
}
-func TypeError(format string, v ...interface{}) *yaml.TypeError {
+func TypeError(format string, v ...any) *yaml.TypeError {
return &yaml.TypeError{Errors: []string{fmt.Sprintf(format, v...)}}
}
diff --git a/pkg/config/config.go b/pkg/config/config.go
index a580337..a7c540f 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -13,7 +13,7 @@ import (
// Map is a convenience type for the non-mapped configuration options
// Mostly used for legacy options
-type Map map[string]interface{}
+type Map map[string]any
// GlobalOptions are not feed specific
type GlobalOptions struct {
@@ -108,12 +108,12 @@ func (cfg *Config) Validate() error {
// WithPartText marks whether 'text' part should be included in mails
func (opt GlobalOptions) WithPartText() bool {
- return util.StrContains(opt.Parts, "text")
+ return util.Contains(opt.Parts, "text")
}
// WithPartHtml marks whether 'html' part should be included in mails
func (opt GlobalOptions) WithPartHtml() bool {
- return util.StrContains(opt.Parts, "html")
+ return util.Contains(opt.Parts, "html")
}
// Load configuration from file and validate it
diff --git a/pkg/config/deprecated.go b/pkg/config/deprecated.go
index 44ed6f6..f373d5e 100644
--- a/pkg/config/deprecated.go
+++ b/pkg/config/deprecated.go
@@ -8,7 +8,7 @@ import (
type deprecated struct {
msg string
- handle func(interface{}, *GlobalOptions, *Options)
+ handle func(any, *GlobalOptions, *Options)
}
var unsupported = deprecated{
@@ -21,7 +21,7 @@ var deprecatedOpts = map[string]deprecated{
"debug-updated": {"Use '-d' as option instead.", nil},
"execurl": {"Use 'exec' instead.", nil},
"filter": {"Use 'item-filter' instead.", nil},
- "disable-ssl-verification": {"Interpreted as 'tls-no-verify'.", func(i interface{}, global *GlobalOptions, opts *Options) {
+ "disable-ssl-verification": {"Interpreted as 'tls-no-verify'.", func(i any, global *GlobalOptions, opts *Options) {
if val, ok := i.(bool); ok {
if val && !opts.NoTLS {
// do not overwrite the set NoTLS flag!
@@ -33,7 +33,7 @@ var deprecatedOpts = map[string]deprecated{
}},
}
-func handleDeprecated(option string, value interface{}, feed string, global *GlobalOptions, opts *Options) bool {
+func handleDeprecated(option string, value any, feed string, global *GlobalOptions, opts *Options) bool {
dep, ok := deprecatedOpts[option]
if !ok {
return false