From b8501fc10bf09755b3aa1cc91391c10d264ab694 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Tue, 30 Nov 2021 16:29:32 +0100 Subject: [PATCH] logs: work around logcheck logcheck complains: Additional arguments to ErrorS should always be Key Value pairs. Please check if there is any key or value missing. That check is intentional, but not applicable here. The check can be worked around by calling the functions through variables. --- test/integration/logs/benchmark/common_test.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/integration/logs/benchmark/common_test.go b/test/integration/logs/benchmark/common_test.go index 7fee16c76fe..b365c475823 100644 --- a/test/integration/logs/benchmark/common_test.go +++ b/test/integration/logs/benchmark/common_test.go @@ -70,10 +70,17 @@ func printf(item logMessage) { } } +// These variables are a workaround for logcheck complaining about the dynamic +// parameters. +var ( + errorS = klog.ErrorS + infoS = klog.InfoS +) + func prints(item logMessage) { if item.isError { - klog.ErrorS(item.err, item.msg, item.kvs...) + errorS(item.err, item.msg, item.kvs...) } else { - klog.InfoS(item.msg, item.kvs...) + infoS(item.msg, item.kvs...) } }