oioss
1package utils2
3import (4"fmt"5"os"6"path/filepath"7"strings"8)
9
10func FindGitDirectories(root string) []string {11var gitDirs []string12
13err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {14if err != nil {15return err16}17if info.IsDir() && strings.HasSuffix(path, ".git") {18gitDirs = append(gitDirs, filepath.Dir(path))19}20return nil21})22
23if err != nil {24fmt.Println("Error:", err)25}26
27return gitDirs28}
29