title: Separating unit tests and integration tests in Go
body: <p>Is there an established best practice for separating unit tests and integration tests in GoLang (testify)? I have a mix of unit tests (which do not rely on any external resources and thus run really fast) and integration tests (which do rely on any external resources and thus run slower). So, I want to be able to control whether or not to include the integration tests when I say <code>go test</code>.</p>
  
  <p>The most straight-forward technique would seem to be to define a -integrate flag in main: </p>
  
  <pre><code>var runIntegrationTests = flag.Bool("integration", false
      , "Run the integration tests (in addition to the unit tests)")
  </code></pre>
  
  <p>And then to add an if-statement to the top of every integration test:</p>
  
  <pre><code>if !*runIntegrationTests {
      this.T().Skip("To run this test, use: go test -integration")
  }
  </code></pre>
  
  <p>Is this the best I can do? I searched the testify documentation to see if there is perhaps a naming convention or something that accomplishes this for me, but didn't find anything. Am I missing something?</p>