Created
June 11, 2021 18:40
-
-
Save r002/b9bd9fd8c814b53f2d981fcde1f3445d to your computer and use it in GitHub Desktop.
Change to ./ root in Go tests to read files (eg. go test .\service\ -v -count=1)
This file contains hidden or 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
func init() { | |
_, filename, _, _ := runtime.Caller(0) | |
fmt.Println(">> Initializing testing:", filename) | |
dir := path.Join(path.Dir(filename), "..") | |
err := os.Chdir(dir) | |
if err != nil { | |
panic(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment