mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #101000 from lojies/ominilcheckforlen
code cleanup: Omit redundant nil check on slices
This commit is contained in:
commit
80085be866
@ -326,7 +326,7 @@ func removeNodeIDFromNode(csiDriverName string) nodeUpdateFunc {
|
||||
// topology information.
|
||||
func updateTopologyLabels(topology map[string]string) nodeUpdateFunc {
|
||||
return func(node *v1.Node) (*v1.Node, bool, error) {
|
||||
if topology == nil || len(topology) == 0 {
|
||||
if len(topology) == 0 {
|
||||
return node, false, nil
|
||||
}
|
||||
|
||||
|
@ -791,7 +791,7 @@ func extractDeviceAndPrefix(mntPath string) (string, string, error) {
|
||||
|
||||
func extractIface(mntPath string) (string, bool) {
|
||||
reOutput := ifaceRe.FindStringSubmatch(mntPath)
|
||||
if reOutput != nil && len(reOutput) > 1 {
|
||||
if len(reOutput) > 1 {
|
||||
return reOutput[1], true
|
||||
}
|
||||
|
||||
|
@ -380,9 +380,9 @@ func (plugin *FakeVolumePlugin) NewDetacher() (Detacher, error) {
|
||||
plugin.NewDetacherCallCount = plugin.NewDetacherCallCount + 1
|
||||
detacher := plugin.getFakeVolume(&plugin.Detachers)
|
||||
attacherList := plugin.Attachers
|
||||
if attacherList != nil && len(attacherList) > 0 {
|
||||
if len(attacherList) > 0 {
|
||||
detacherList := plugin.Detachers
|
||||
if detacherList != nil && len(detacherList) > 0 {
|
||||
if len(detacherList) > 0 {
|
||||
detacherList[0].VolumesAttached = attacherList[0].VolumesAttached
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ func Invalid(field *Path, value interface{}, detail string) *Error {
|
||||
// valid values).
|
||||
func NotSupported(field *Path, value interface{}, validValues []string) *Error {
|
||||
detail := ""
|
||||
if validValues != nil && len(validValues) > 0 {
|
||||
if len(validValues) > 0 {
|
||||
quotedValues := make([]string, len(validValues))
|
||||
for i, v := range validValues {
|
||||
quotedValues[i] = strconv.Quote(v)
|
||||
|
Loading…
Reference in New Issue
Block a user