mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Use early return pattern to avoid nested conditions
Signed-off-by: jongwooo <jongwooo.han@gmail.com>
This commit is contained in:
		@@ -140,15 +140,15 @@ func (s *sourceFile) consumeWatchEvent(e *watchEvent) error {
 | 
				
			|||||||
			pod, podExist, err := s.store.GetByKey(objKey)
 | 
								pod, podExist, err := s.store.GetByKey(objKey)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				return err
 | 
									return err
 | 
				
			||||||
			} else if !podExist {
 | 
								}
 | 
				
			||||||
 | 
								if !podExist {
 | 
				
			||||||
				return fmt.Errorf("the pod with key %s doesn't exist in cache", objKey)
 | 
									return fmt.Errorf("the pod with key %s doesn't exist in cache", objKey)
 | 
				
			||||||
			} else {
 | 
								}
 | 
				
			||||||
			if err = s.store.Delete(pod); err != nil {
 | 
								if err = s.store.Delete(pod); err != nil {
 | 
				
			||||||
				return fmt.Errorf("failed to remove deleted pod from cache: %v", err)
 | 
									return fmt.Errorf("failed to remove deleted pod from cache: %v", err)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			delete(s.fileKeyMapping, e.fileName)
 | 
								delete(s.fileKeyMapping, e.fileName)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user