It seems go test ./...
runs each test file using the file's directory as the root dir.
E.g., if a test is my_project/service/service_test.go
, then it is run with root dir set to my_project/service/
.
This causes trouble because I need to load config files during the test, which are located at my_project/config
.
What I am doing now is setting an env variable WORK_DIR
, setting it to my_project
, and using it to load the config files.
Is there a feature in Go that allows setting the work dir for tests?