diff --git a/file/file.go b/file/file.go index 3dbaddb..adecfbe 100644 --- a/file/file.go +++ b/file/file.go @@ -3,18 +3,10 @@ package file import ( "os" "path/filepath" - "runtime" ) -var ( - _, b, _, _ = runtime.Caller(0) - - // Root folder of this project - ProjectRoot = filepath.Join(filepath.Dir(b), "..") -) - -// GetBasePath returns the root folder of the project -func GetBasePath() string { +// ProjectRoot returns the root folder of the project +func ProjectRoot() string { dir, err := os.Getwd() if err != nil { panic(err) diff --git a/file/file_test.go b/file/file_test.go index bb6d84a..b10fdfa 100644 --- a/file/file_test.go +++ b/file/file_test.go @@ -5,15 +5,9 @@ import ( "testing" ) -func TestProjectRoot(t *testing.T) { - if !strings.Contains(ProjectRoot, "abrolgo") { - t.Errorf("ProjectRoot is not correct: %s", ProjectRoot) - } -} - func TestGetBasePath(t *testing.T) { - basePath := GetBasePath() + basePath := ProjectRoot() if !strings.Contains(basePath, "abrolgo") { - t.Errorf("GetBasePath is not correct: %s", basePath) + t.Errorf("ProjectRoot is not correct: %s", basePath) } }