INNER CODE UNIT · Go
cwd
deckhouse/deckhouse · deckhouse-controller/register/main.go:38
func cwd() string {
_, f, _, ok := runtime.Caller(1)
if !ok {
panic("cannot get caller")
}
dir, err := filepath.Abs(f)
if err != nil {
panic(err)
}
for i := 0; i < 3; i++ { // ../../../
dir = filepath.Dir(dir)
}
// If deckhouse repo directory is symlinked (e.g. to /deckhouse), resolve the real path.
// Otherwise, filepath.Walk will ignore all subdirectories.
dir, err = filepath.EvalSymlinks(dir)