summaryrefslogtreecommitdiffstats
path: root/tpl/images
diff options
context:
space:
mode:
authorCameron Moore <moorereason@gmail.com>2017-05-02 02:17:14 -0500
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-05-02 09:17:14 +0200
commitf604076de17e5c06ba25a07ee8c8a55d1bb6b936 (patch)
tree184036f2a3bea9577af59cfd423c8a7fa3fd6aca /tpl/images
parentf69df916df341671d602fcc4f2604838b1ea72ec (diff)
tpl/images: Fix embedded sync.Mutex
Diffstat (limited to 'tpl/images')
-rw-r--r--tpl/images/images.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/tpl/images/images.go b/tpl/images/images.go
index 127057853..9244323b4 100644
--- 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
}