diff --git a/module/repo.go b/module/repo.go index 20d68b5..46dd5b6 100644 --- a/module/repo.go +++ b/module/repo.go @@ -54,8 +54,12 @@ func (r *Repo) InjectTo(ctx context.Context) (context.Context, error) { r.locker.RUnlock() if needCreating { + var err error + r.locker.Lock() - err := r.buildValues(ctx) + if len(r.instances) == 0 { + err = r.buildValues(ctx) + } r.locker.Unlock() if err != nil {