i'm trying to set a variable from my unit tests file
main_test.go
var testingMode bool = true
main.go
if testingMode == true {
//use test database
} else {
//use regular database
}
If I run "go test", this works fine. If I do "go build", golang complains that testingMode is not defined (which should be the case since tests aren't part of the program).
But it seems if I set the global variable in main.go, I'm unable to set it in main_test.
What's the correct way to about this?