package main import ( "os" "testing" ) func TestMain(m *testing.M) { // call flag.Parse() here if TestMain uses flags readConfigForTest() //setup config for test cases os.Exit(m.Run()) }