Remove GetLazydockerRootDirectory function

This commit is contained in:
Gustavo Andrioli 2022-10-10 21:22:55 -03:00
parent dd11b0ee10
commit 574e0b6f90

View file

@ -5,10 +5,7 @@ import (
"fmt" "fmt"
"html/template" "html/template"
"io" "io"
"log"
"math" "math"
"os"
"path/filepath"
"reflect" "reflect"
"regexp" "regexp"
"sort" "sort"
@ -411,31 +408,3 @@ func IsValidHexValue(v string) bool {
return true return true
} }
// GetLazydockerRootDirectory finds lazydocker root directory.
//
// It's used for our cheatsheet script and integration tests. Not to be confused with finding the
// root directory of _any_ random repo.
func GetLazydockerRootDirectory() string {
path, err := os.Getwd()
if err != nil {
panic(err)
}
for {
_, err := os.Stat(filepath.Join(path, ".git"))
if err == nil {
return path
}
if !os.IsNotExist(err) {
panic(err)
}
path = filepath.Dir(path)
if path == "/" {
log.Fatal("must run in lazydocker folder or child folder")
}
}
}