aboutsummaryrefslogtreecommitdiff
path: root/internal/config/config.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-18 22:24:38 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-18 22:24:38 +0200
commitf3d3b16108e202f022868177ef1c9f8b67432037 (patch)
treefa716166940d153199cbb8d1e388241578203ea4 /internal/config/config.go
parent59765a755d411fbf5ecba3a7d7f70c0ee7466a1e (diff)
downloadfeed2imap-go-f3d3b16108e202f022868177ef1c9f8b67432037.tar.gz
feed2imap-go-f3d3b16108e202f022868177ef1c9f8b67432037.tar.bz2
feed2imap-go-f3d3b16108e202f022868177ef1c9f8b67432037.zip
Tests for `buildFeeds` and corresponding fixes
Diffstat (limited to 'internal/config/config.go')
-rw-r--r--internal/config/config.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 361246e..e330a48 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -3,11 +3,37 @@ package config
import (
"fmt"
"io/ioutil"
+ "strings"
)
type Map map[string]interface{}
type Feeds map[string]*Feed
+func (f Feeds) String() string {
+ var b strings.Builder
+ app := func(a ...interface{}) {
+ _, _ = fmt.Fprint(&b, a...)
+ }
+ app("Feeds [")
+
+ first := true
+ for k, v := range f {
+ if !first {
+ app(", ")
+ }
+ app(`"`, k, `"`, ": ")
+ if v == nil {
+ app("<nil>")
+ } else {
+ _, _ = fmt.Fprintf(&b, "%+v", *v)
+ }
+ first = false
+ }
+ app("]")
+
+ return b.String()
+}
+
type Config struct {
GlobalConfig Map
Feeds Feeds