aboutsummaryrefslogtreecommitdiff
path: root/pkg/config
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2021-06-02 23:05:49 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2021-06-02 23:10:40 +0200
commit54d3ea0e7bce0a97db63c9cfa7b54794743b42a8 (patch)
tree87c532727839a8285273736e83577b81297164dc /pkg/config
parent97d4fb607f5b4de1319bf20dae03b29e14010404 (diff)
downloadfeed2imap-go-54d3ea0e7bce0a97db63c9cfa7b54794743b42a8.tar.gz
feed2imap-go-54d3ea0e7bce0a97db63c9cfa7b54794743b42a8.tar.bz2
feed2imap-go-54d3ea0e7bce0a97db63c9cfa7b54794743b42a8.zip
Change handling of NULL nodes to new yaml.v3 semantics
Diffstat (limited to '')
-rw-r--r--pkg/config/yaml.go21
1 files changed, 7 insertions, 14 deletions
diff --git a/pkg/config/yaml.go b/pkg/config/yaml.go
index c82a57e..48269ba 100644
--- a/pkg/config/yaml.go
+++ b/pkg/config/yaml.go
@@ -13,9 +13,8 @@ import (
)
const (
- strTag = "!!str"
- nullTag = "!!null"
- emptyTag = ""
+ strTag = "!!str"
+ nullTag = "!!null"
)
type config struct {
@@ -51,19 +50,13 @@ func (grpFeed *configGroupFeed) isFeed() bool {
}
func (grpFeed *configGroupFeed) target(autoTarget bool) string {
- tag := grpFeed.Target.ShortTag()
- switch tag {
- case strTag:
- return grpFeed.Target.Value
- case nullTag:
- return ""
- case emptyTag:
- if !autoTarget {
+ if !autoTarget || !grpFeed.Target.IsZero() {
+ if grpFeed.Target.ShortTag() == nullTag {
+ // null may be represented by ~ or NULL or ...
+ // Value would hold this representation, which we do not want
return ""
}
- // tag not set and autoTarget is on: continue on
- default:
- panic("unexpected tag " + tag + " for target node")
+ return grpFeed.Target.Value
}
if grpFeed.Feed.Name != "" {