hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit f604076de17e5c06ba25a07ee8c8a55d1bb6b936
parent f69df916df341671d602fcc4f2604838b1ea72ec
Author: Cameron Moore <moorereason@gmail.com>
Date:   Tue,  2 May 2017 02:17:14 -0500

tpl/images: Fix embedded sync.Mutex


Diffstat:
Mdocs/data/docs.json | 30------------------------------
Mtpl/images/images.go | 12++++++------
2 files changed, 6 insertions(+), 36 deletions(-)
diff --git a/docs/data/docs.json b/docs/data/docs.json
@@ -727,36 +727,6 @@
               "imageConfig"
             ],
             "Examples": []
-          },
-          {
-            "Name": "Lock",
-            "Description": "",
-            "Aliases": null,
-            "Examples": null
-          },
-          {
-            "Name": "RLock",
-            "Description": "",
-            "Aliases": null,
-            "Examples": null
-          },
-          {
-            "Name": "RLocker",
-            "Description": "",
-            "Aliases": null,
-            "Examples": null
-          },
-          {
-            "Name": "RUnlock",
-            "Description": "",
-            "Aliases": null,
-            "Examples": null
-          },
-          {
-            "Name": "Unlock",
-            "Description": "",
-            "Aliases": null,
-            "Examples": null
           }
         ]
       },
diff --git a/tpl/images/images.go b/tpl/images/images.go
@@ -37,8 +37,8 @@ func New(deps *deps.Deps) *Namespace {
 
 // Namespace provides template functions for the "images" namespace.
 type Namespace struct {
-	sync.RWMutex
-	cache map[string]image.Config
+	cacheMu sync.RWMutex
+	cache   map[string]image.Config
 
 	deps *deps.Deps
 }
@@ -56,9 +56,9 @@ func (ns *Namespace) Config(path interface{}) (image.Config, error) {
 	}
 
 	// Check cache for image config.
-	ns.RLock()
+	ns.cacheMu.RLock()
 	config, ok := ns.cache[filename]
-	ns.RUnlock()
+	ns.cacheMu.RUnlock()
 
 	if ok {
 		return config, nil
@@ -71,9 +71,9 @@ func (ns *Namespace) Config(path interface{}) (image.Config, error) {
 
 	config, _, err = image.DecodeConfig(f)
 
-	ns.Lock()
+	ns.cacheMu.Lock()
 	ns.cache[filename] = config
-	ns.Unlock()
+	ns.cacheMu.Unlock()
 
 	return config, err
 }