Skip to content

Commit

Permalink
Replace strings.TrimRight with strings.TrimSuffix
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
relu committed Nov 11, 2021
1 parent ae455c9 commit 3619625
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/update/setters.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3619625

Please sign in to comment.