func (s *SingleFlight) Load(key interface{}) (val interface{}, err error, loaded bool) {
	s.mu.RLock()
	defer s.mu.RUnlock()
	var eUntyped interface{}
	eUntyped, loaded = s.store.Load(key)
	if loaded {
		e := eUntyped.(*entry)
		val = e.val
		err = e.err
	}
	return
}
Load is similar to a sync.Map.Load.

Callers must check loaded before val and err. Their value is meaninful only
if loaded is true. The err is not the last returned value because it would
likely lead the reader to think that err must be checked before loaded.
lint:ignore ST1008 loaded must be last, see above.
package cache
import (
	"sync"
)
type SingleFlight struct {
	mu    sync.RWMutex  
	store sync.Map
}
type entry struct {
	compute sync.Once
	val     interface{}
	err     error
}
func (s *SingleFlight) LoadOrStore(key interface{}, valFn func() (val interface{}, err error)) (interface{}, error) {
	s.mu.RLock()
	defer s.mu.RUnlock()
	eUntyped, _ := s.store.LoadOrStore(key, &entry{})
	e := eUntyped.(*entry)
	e.compute.Do(func() {
		e.val, e.err = valFn()
	})
	return e.val, e.err
}