MCPcopy Create free account
hub / github.com/ddev/ddev / findRepoRoot

Function findRepoRoot

pkg/testsetup/ddevbin.go:58–74  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

56}
57
58func findRepoRoot() (string, error) {
59 dir, err := os.Getwd()
60 if err != nil {
61 return "", err
62 }
63
64 for {
65 if fileutil.FileExists(filepath.Join(dir, "go.mod")) && fileutil.FileExists(filepath.Join(dir, "Makefile")) {
66 return dir, nil
67 }
68 parent := filepath.Dir(dir)
69 if parent == dir {
70 return "", fmt.Errorf("repository root not found from %s", dir)
71 }
72 dir = parent
73 }
74}

Callers 1

ResolveDdevBinaryFunction · 0.85

Calls 2

FileExistsFunction · 0.92
ErrorfMethod · 0.80

Tested by

no test coverage detected