func (s *Service) ListDirectories(context.Context) ([]*Directory, error) {
	s.mu.RLock()
	dirs := s.dirs
	s.mu.RUnlock()
	return dirs, nil
}
ListDirectories lists directories in sorted order.
package code
import (
	"context"
	"fmt"
	"os"
	"os/exec"
	"path"
	"path/filepath"
	"sort"
	"sync"
	"time"
	"github.com/shurcooL/events"
	"github.com/shurcooL/events/event"
	"github.com/shurcooL/home/internal/exp/service/notification"
	"github.com/shurcooL/users"
)
type Service struct {
	reposDir string
	mu           sync.RWMutex
	dirs         []*Directory           
	byImportPath map[string]*Directory  
	notification notification.Service
	events       events.ExternalService
	users        users.Service
}
func NewService(reposDir string, notification notification.Service, events events.ExternalService, users users.Service) (*Service, error) {
	dirs, byImportPath, err := discover(reposDir)
	if err != nil {
		return nil, err
	}
	return &Service{
		reposDir: reposDir,
		dirs:         dirs,
		byImportPath: byImportPath,
		notification: notification,
		events:       events,
		users:        users,
	}, nil
}