diff --git a/packer/cache.go b/packer/cache.go index 6f8d14134..6c2ed0207 100644 --- a/packer/cache.go +++ b/packer/cache.go @@ -44,7 +44,7 @@ func (f *FileCache) Lock(key string) string { rw := f.rwLock(hashKey) rw.Lock() - return filepath.Join(f.CacheDir, hashKey) + return f.cachePath(key, hashKey) } func (f *FileCache) Unlock(key string) { @@ -58,7 +58,7 @@ func (f *FileCache) RLock(key string) (string, bool) { rw := f.rwLock(hashKey) rw.RLock() - return filepath.Join(f.CacheDir, hashKey), true + return f.cachePath(key, hashKey), true } func (f *FileCache) RUnlock(key string) { @@ -67,6 +67,10 @@ func (f *FileCache) RUnlock(key string) { rw.RUnlock() } +func (f *FileCache) cachePath(key string, hashKey string) string { + return filepath.Join(f.CacheDir, hashKey) +} + func (f *FileCache) hashKey(key string) string { sha := sha256.New() sha.Write([]byte(key))