From 3d53547518c01b28594c93c00644d08b68fb49bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lovro=20Ma=C5=BEgon?= Date: Mon, 15 Apr 2024 13:33:36 +0200 Subject: [PATCH] document behavior --- config/config.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/config/config.go b/config/config.go index 4987271..06763c7 100644 --- a/config/config.go +++ b/config/config.go @@ -219,11 +219,14 @@ func (c Config) getKeysForParameter(key string) []string { break } - // Between tokens there is a wildcard, we need to strip the key until - // the next ".". - _, k, ok = strings.Cut(k, ".") - if ok { - k = "." + k // Add the "." back to the key. + // Between tokens there is a wildcard, we need to consume the key + // until the next ".". If there is no next ".", the whole key is + // consumed. + // e.g. "foo.format" -> ".format" or "foo" -> "" + if index := strings.IndexRune(k, '.'); index != -1 { + k = k[index:] + } else { + k = "" } } }