Skip to content

Commit b074e3a

Browse files
committed
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 <[email protected]> (cherry picked from commit 799bca9) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 0794797 commit b074e3a

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

reference/reference.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package reference
1818

1919
import (
2020
"errors"
21-
"fmt"
2221
"net/url"
2322
"path"
2423
"regexp"
@@ -146,10 +145,10 @@ func (r Spec) String() string {
146145
return r.Locator
147146
}
148147
if r.Object[:1] == "@" {
149-
return fmt.Sprintf("%v%v", r.Locator, r.Object)
148+
return r.Locator + r.Object
150149
}
151150

152-
return fmt.Sprintf("%v:%v", r.Locator, r.Object)
151+
return r.Locator + ":" + r.Object
153152
}
154153

155154
// SplitObject provides two parts of the object spec, delimited by an `@`

0 commit comments

Comments
 (0)