diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-04-18 22:24:38 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-04-18 22:24:38 +0200 |
commit | f3d3b16108e202f022868177ef1c9f8b67432037 (patch) | |
tree | fa716166940d153199cbb8d1e388241578203ea4 /internal/config/config.go | |
parent | 59765a755d411fbf5ecba3a7d7f70c0ee7466a1e (diff) | |
download | feed2imap-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.go | 26 |
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 |