From 3619625484e865824300c8ffe072be8ac195f788 Mon Sep 17 00:00:00 2001 From: Aurel Canciu Date: Thu, 11 Nov 2021 13:41:48 +0100 Subject: [PATCH] Replace strings.TrimRight with strings.TrimSuffix TrimRight was not correctly used. It takes a set of characters as the second argument and any chars matching the set on the right side of the string would be trimmed. TrimSuffix does exactly what I originally intended. Signed-off-by: Aurel Canciu --- pkg/update/setters.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/update/setters.go b/pkg/update/setters.go index 50b7e660..d4af8b59 100644 --- a/pkg/update/setters.go +++ b/pkg/update/setters.go @@ -160,7 +160,7 @@ func UpdateWithSetters(tracelog logr.Logger, inpath, outpath string, policies [] // annoyingly, neither the library imported above, nor an // alternative I found, will yield the original image name; // this is an easy way to get it - name := strings.TrimRight(image, ":"+tag) + name := strings.TrimSuffix(image, ":"+tag) imageSetter := fmt.Sprintf("%s:%s", policy.GetNamespace(), policy.GetName()) tracelog.Info("adding setter", "name", imageSetter)