From 799bca97f2dd7421faaaf9d0b5842264359a87ea Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 27 Jun 2024 11:41:43 +0200 Subject: [PATCH] pkg/reference: Spec.String(): use string-concatenation instead of sprintf These were straight concatenations of strings; reduce some allocations by removing fmt.Sprintf for this. Signed-off-by: Sebastiaan van Stijn --- pkg/reference/reference.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/reference/reference.go b/pkg/reference/reference.go index a4bf6da60..23b88214e 100644 --- a/pkg/reference/reference.go +++ b/pkg/reference/reference.go @@ -18,7 +18,6 @@ package reference import ( "errors" - "fmt" "net/url" "path" "regexp" @@ -146,10 +145,10 @@ func (r Spec) String() string { return r.Locator } if r.Object[:1] == "@" { - return fmt.Sprintf("%v%v", r.Locator, r.Object) + return r.Locator + r.Object } - return fmt.Sprintf("%v:%v", r.Locator, r.Object) + return r.Locator + ":" + r.Object } // SplitObject provides two parts of the object spec, delimited by an `@`