From 6506e0c51afd8ec554f027fe7f8d5ce3a61a0160 Mon Sep 17 00:00:00 2001 From: wangqingcan Date: Thu, 6 Sep 2018 09:12:39 +0800 Subject: [PATCH] Simple code and typo fixed in in kubelet --- pkg/kubelet/reason_cache.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/kubelet/reason_cache.go b/pkg/kubelet/reason_cache.go index 60327baf95..4c42ab8a7c 100644 --- a/pkg/kubelet/reason_cache.go +++ b/pkg/kubelet/reason_cache.go @@ -40,8 +40,8 @@ type ReasonCache struct { cache *lru.Cache } -// ReasonItem is the cached item in ReasonCache -type ReasonItem struct { +// Reason is the cached item in ReasonCache +type reasonItem struct { Err error Message string } @@ -64,7 +64,7 @@ func (c *ReasonCache) composeKey(uid types.UID, name string) string { func (c *ReasonCache) add(uid types.UID, name string, reason error, message string) { c.lock.Lock() defer c.lock.Unlock() - c.cache.Add(c.composeKey(uid, name), ReasonItem{reason, message}) + c.cache.Add(c.composeKey(uid, name), reasonItem{reason, message}) } // Update updates the reason cache with the SyncPodResult. Only SyncResult with @@ -93,13 +93,13 @@ func (c *ReasonCache) Remove(uid types.UID, name string) { // Get gets error reason from the cache. The return values are error reason, error message and // whether an error reason is found in the cache. If no error reason is found, empty string will // be returned for error reason and error message. -func (c *ReasonCache) Get(uid types.UID, name string) (*ReasonItem, bool) { +func (c *ReasonCache) Get(uid types.UID, name string) (*reasonItem, bool) { c.lock.Lock() defer c.lock.Unlock() value, ok := c.cache.Get(c.composeKey(uid, name)) if !ok { return nil, false } - info := value.(ReasonItem) + info := value.(reasonItem) return &info, true }