title: golang TestMain() function sets variable that can't be accessed by tests
body: <p>I've got the following TestMain function:</p>
  
  <pre><code>func TestMain(m *testing.M) {
    db := "[working_db_connection]"
    dbInstance, _ := InitializeRepo(db, 2)
    runTests := m.Run()
    os.Exit(runTests)
  }
  </code></pre>
  
  <p>and the following sample test</p>
  
  <pre><code>func TestSomeFeature(t *testing.T) {
    fmt.Println(dbInstance)
  }
  </code></pre>
  
  <p>The function TestSomeFeature does run, but says dbInstance is undefined. Why would this not have access to the variable? From examples I'm seeing variables et in TestMain are accessed with this syntax.</p>