aboutsummaryrefslogtreecommitdiff
path: root/internal/config/yaml.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/yaml.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/yaml.go')
-rw-r--r--internal/config/yaml.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/config/yaml.go b/internal/config/yaml.go
index 156737d..2f507cc 100644
--- a/internal/config/yaml.go
+++ b/internal/config/yaml.go
@@ -27,7 +27,7 @@ func (grpFeed *configGroupFeed) isGroup() bool {
}
func (grpFeed *configGroupFeed) isFeed() bool {
- return grpFeed.Name != ""
+ return grpFeed.Feed != Feed{}
}
func (grpFeed *configGroupFeed) target() string {
@@ -60,12 +60,13 @@ func appTarget(target, app string) string {
return target
}
- return target + "/" + app
+ return target + "." + app
}
// Parse the group structure and populate the `Target` fields in the feeds
func buildFeeds(cfg []configGroupFeed, target string, feeds Feeds) error {
- for _, f := range cfg {
+ for idx := range cfg {
+ f := &cfg[idx] // cannot use `_, f := range cfg` as it returns copies(!), but we need the originals
target := appTarget(target, f.target())
switch {
case f.isFeed() && f.isGroup():