-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: extract version from go.mod (#561)
* extract version from go.mod * add util func to get project root
- Loading branch information
1 parent
d6b69e3
commit 6457d52
Showing
3 changed files
with
56 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package test | ||
|
||
import ( | ||
"path/filepath" | ||
"runtime" | ||
) | ||
|
||
// ProjectRootPath returns the root directory of this project. | ||
func ProjectRootPath() string { | ||
_, b, _, _ := runtime.Caller(0) //nolint:dogsled | ||
|
||
// Returns root directory of this project. | ||
// NOTE: it depends on the path of this file itself. When the file is moved, the second param may need updating. | ||
return filepath.Join(filepath.Dir(b), "../../..") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters