From ae8bbc63da4af0f9df8f46711b843246d0ef4e73 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 15 Jun 2020 14:02:04 +0100 Subject: [PATCH] cache: export Canonicalize method for external use --- fs/cache/cache.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/cache/cache.go b/fs/cache/cache.go index 731477bd8..fec9a6fe1 100644 --- a/fs/cache/cache.go +++ b/fs/cache/cache.go @@ -14,9 +14,9 @@ var ( remap = map[string]string{} // map user supplied names to canonical names ) -// Lookup fsString in the mapping from user supplied names to -// canonical names and return the canonical form -func canonicalize(fsString string) string { +// Canonicalize looks up fsString in the mapping from user supplied +// names to canonical names and return the canonical form +func Canonicalize(fsString string) string { mu.Lock() canonicalName, ok := remap[fsString] mu.Unlock() @@ -40,7 +40,7 @@ func addMapping(fsString, canonicalName string) { // GetFn gets an fs.Fs named fsString either from the cache or creates // it afresh with the create function func GetFn(fsString string, create func(fsString string) (fs.Fs, error)) (f fs.Fs, err error) { - fsString = canonicalize(fsString) + fsString = Canonicalize(fsString) created := false value, err := c.Get(fsString, func(fsString string) (f interface{}, ok bool, err error) { f, err = create(fsString)