mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
simplify returning boolean expression in staging/src/k8s.io/client-go/tools
Signed-off-by: 刁浩 10284789 <diao.hao@zte.com.cn>
This commit is contained in:
parent
d8f9e4587a
commit
9173414da6
@ -263,10 +263,7 @@ func (f *FIFO) GetByKey(key string) (item interface{}, exists bool, err error) {
|
|||||||
func (f *FIFO) IsClosed() bool {
|
func (f *FIFO) IsClosed() bool {
|
||||||
f.lock.Lock()
|
f.lock.Lock()
|
||||||
defer f.lock.Unlock()
|
defer f.lock.Unlock()
|
||||||
if f.closed {
|
return f.closed
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pop waits until an item is ready and processes it. If multiple items are
|
// Pop waits until an item is ready and processes it. If multiple items are
|
||||||
|
@ -304,10 +304,7 @@ func (h *Heap) GetByKey(key string) (interface{}, bool, error) {
|
|||||||
func (h *Heap) IsClosed() bool {
|
func (h *Heap) IsClosed() bool {
|
||||||
h.lock.RLock()
|
h.lock.RLock()
|
||||||
defer h.lock.RUnlock()
|
defer h.lock.RUnlock()
|
||||||
if h.closed {
|
return h.closed
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewHeap returns a Heap which can be used to queue up items to process.
|
// NewHeap returns a Heap which can be used to queue up items to process.
|
||||||
|
@ -135,11 +135,7 @@ func (o *PathOptions) GetDefaultFilename() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o *PathOptions) IsExplicitFile() bool {
|
func (o *PathOptions) IsExplicitFile() bool {
|
||||||
if len(o.LoadingRules.ExplicitPath) > 0 {
|
return len(o.LoadingRules.ExplicitPath) > 0
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *PathOptions) GetExplicitFile() string {
|
func (o *PathOptions) GetExplicitFile() string {
|
||||||
|
@ -36,9 +36,5 @@ func ValidateEventType(eventtype string) bool {
|
|||||||
func IsKeyNotFoundError(err error) bool {
|
func IsKeyNotFoundError(err error) bool {
|
||||||
statusErr, _ := err.(*errors.StatusError)
|
statusErr, _ := err.(*errors.StatusError)
|
||||||
|
|
||||||
if statusErr != nil && statusErr.Status().Code == http.StatusNotFound {
|
return statusErr != nil && statusErr.Status().Code == http.StatusNotFound
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user