Created
June 25, 2024 07:01
-
-
Save madflow/220af82bbe336829a2d1f8bf251085f4 to your computer and use it in GitHub Desktop.
Go Testing Init
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
package testing | |
import ( | |
"os" | |
"path" | |
"runtime" | |
) | |
func init() { | |
_, filename, _, _ := runtime.Caller(0) | |
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