mirror of https://github.com/k3s-io/k3s
Only do string trim when it's necessary
This will enhance performance a little bit.pull/6/head
parent
bcccbc3d0b
commit
fbcbb77fc8
|
@ -50,8 +50,6 @@ func (defaultNodeIdentifier) NodeIdentity(u user.Info) (string, bool) {
|
||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeName := strings.TrimPrefix(userName, nodeUserNamePrefix)
|
|
||||||
|
|
||||||
isNode := false
|
isNode := false
|
||||||
for _, g := range u.GetGroups() {
|
for _, g := range u.GetGroups() {
|
||||||
if g == user.NodesGroup {
|
if g == user.NodesGroup {
|
||||||
|
@ -63,5 +61,6 @@ func (defaultNodeIdentifier) NodeIdentity(u user.Info) (string, bool) {
|
||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
|
|
||||||
return nodeName, isNode
|
nodeName := strings.TrimPrefix(userName, nodeUserNamePrefix)
|
||||||
|
return nodeName, true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue