diff --git a/file/file.go b/file/file.go new file mode 100644 index 0000000..c0263a2 --- /dev/null +++ b/file/file.go @@ -0,0 +1,13 @@ +package file + +import ( + "path/filepath" + "runtime" +) + +var ( + _, b, _, _ = runtime.Caller(0) + + // Root folder of this project + ProjectRoot = filepath.Join(filepath.Dir(b), "..") +) diff --git a/file/file_test.go b/file/file_test.go new file mode 100644 index 0000000..582d683 --- /dev/null +++ b/file/file_test.go @@ -0,0 +1,12 @@ +package file + +import ( + "strings" + "testing" +) + +func TestProjectRoot(t *testing.T) { + if !strings.Contains(ProjectRoot, "abrolgo") { + t.Errorf("ProjectRoot is not correct: %s", ProjectRoot) + } +}