mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
remove unused func NewNamespacedNameFromString
This commit is contained in:
parent
a7d6340ad2
commit
04862d7829
@ -18,7 +18,6 @@ package types
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// NamespacedName comprises a resource name, with a mandatory namespace,
|
||||
@ -42,19 +41,3 @@ const (
|
||||
func (n NamespacedName) String() string {
|
||||
return fmt.Sprintf("%s%c%s", n.Namespace, Separator, n.Name)
|
||||
}
|
||||
|
||||
// NewNamespacedNameFromString parses the provided string and returns a NamespacedName.
|
||||
// The expected format is as per String() above.
|
||||
// If the input string is invalid, the returned NamespacedName has all empty string field values.
|
||||
// This allows a single-value return from this function, while still allowing error checks in the caller.
|
||||
// Note that an input string which does not include exactly one Separator is not a valid input (as it could never
|
||||
// have neem returned by String() )
|
||||
func NewNamespacedNameFromString(s string) NamespacedName {
|
||||
nn := NamespacedName{}
|
||||
result := strings.Split(s, string(Separator))
|
||||
if len(result) == 2 {
|
||||
nn.Namespace = result[0]
|
||||
nn.Name = result[1]
|
||||
}
|
||||
return nn
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user