From f3d3b16108e202f022868177ef1c9f8b67432037 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Sat, 18 Apr 2020 22:24:38 +0200 Subject: Tests for `buildFeeds` and corresponding fixes --- internal/config/yaml.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'internal/config/yaml.go') 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(): -- cgit v1.2.3-70-g09d2