Optimize string building for NamespacedName

This commit is contained in:
Markus Thömmes 2020-10-23 10:42:31 +02:00
parent ededd08ba1
commit 668d560618

View File

@ -16,10 +16,6 @@ limitations under the License.
package types
import (
"fmt"
)
// NamespacedName comprises a resource name, with a mandatory namespace,
// rendered as "<namespace>/<name>". Being a type captures intent and
// helps make sure that UIDs, namespaced names and non-namespaced names
@ -39,5 +35,5 @@ const (
// String returns the general purpose string representation
func (n NamespacedName) String() string {
return fmt.Sprintf("%s%c%s", n.Namespace, Separator, n.Name)
return n.Namespace + string(Separator) + n.Name
}