From 4782476b8b5a0e38004bde71654c554682c85329 Mon Sep 17 00:00:00 2001 From: Dmitry Anoshin Date: Tue, 21 Jan 2025 11:51:46 -0800 Subject: [PATCH] [chore] Fix deprecation warning for multiline config source calls --- internal/configsource/source.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/internal/configsource/source.go b/internal/configsource/source.go index 22c1b6cb65..44c9b8ae9f 100644 --- a/internal/configsource/source.go +++ b/internal/configsource/source.go @@ -368,10 +368,18 @@ func resolveStringValue(ctx context.Context, configSources map[string]ConfigSour } default: if deprecatedFormUsed { - printDeprecationWarningOnce(fmt.Sprintf( - "[WARNING] Config source expansion formatted as $uri:selector has been deprecated, "+ - "use ${uri:selector[?params]} instead. Please replace $%s with ${%s} in your configuration", - expandableContent, expandableContent)) + if strings.Contains(expandableContent, "\n") { + printDeprecationWarningOnce(fmt.Sprintf( + "[WARNING] Calling config sources in multiline format is deprecated. "+ + "Please convert the following call to the one-line format ${uri:selector?param1"+ + "=value1,param2=value2}:\n %s", + expandableContent)) + } else { + printDeprecationWarningOnce(fmt.Sprintf( + "[WARNING] Config source expansion formatted as $uri:selector has been deprecated, "+ + "use ${uri:selector[?params]} instead. Please replace $%s with ${%s} in your configuration", + expandableContent, expandableContent)) + } } } }