// use outapi::Outapi.GenerateUniqueID() as identifier // a nil may be returned indicating error func GetFs(io outapi.Outapi) *Fs { var id = io.GenerateUniqueID() fsMapLock.RLock() if elem, ok := globalFsMap[id]; ok { fsMapLock.RUnlock() return elem } fsMapLock.RUnlock() fsMapLock.Lock() defer fsMapLock.Unlock() if elem, ok := globalFsMap[id]; ok { return elem } var ret = newFs(io) globalFsMap[id] = ret return ret }