From 4215d1ea0723be1e54035664f3b2c232c298d695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Thu, 6 Jan 2022 15:31:01 +0100 Subject: [PATCH 1/2] do not concat version if not specified --- libbeat/common/cfgwarn/cfgwarn.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libbeat/common/cfgwarn/cfgwarn.go b/libbeat/common/cfgwarn/cfgwarn.go index e102ed20e4b6..94ace44d8453 100644 --- a/libbeat/common/cfgwarn/cfgwarn.go +++ b/libbeat/common/cfgwarn/cfgwarn.go @@ -35,7 +35,10 @@ func Beta(format string, v ...interface{}) { // Deprecate logs a deprecation message. // The version string contains the version when the future will be removed func Deprecate(version string, format string, v ...interface{}) { - postfix := fmt.Sprintf(" Will be removed in version: %s", version) + var postfix string + if version != "" { + postfix = fmt.Sprintf(" Will be removed in version: %s", version) + } logp.NewLogger(selector, zap.AddCallerSkip(1)).Warnf("DEPRECATED: "+format+postfix, v...) } From 23bd391458af217dc89798d582a3e1f25a1a478a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Thu, 6 Jan 2022 15:46:03 +0100 Subject: [PATCH 2/2] add comment --- libbeat/common/cfgwarn/cfgwarn.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libbeat/common/cfgwarn/cfgwarn.go b/libbeat/common/cfgwarn/cfgwarn.go index 94ace44d8453..0295b0b6d3b9 100644 --- a/libbeat/common/cfgwarn/cfgwarn.go +++ b/libbeat/common/cfgwarn/cfgwarn.go @@ -33,7 +33,8 @@ func Beta(format string, v ...interface{}) { } // Deprecate logs a deprecation message. -// The version string contains the version when the future will be removed +// The version string contains the version when the future will be removed. +// If version is empty, the message will not mention the removal of the feature. func Deprecate(version string, format string, v ...interface{}) { var postfix string if version != "" {