title: go test can not load package with command: go test file1_test.go file2.go
body: <p>I am writing units test. I put all of the test files in other directory. Let's say the folder mypack.</p>
  
  <p>There two files in the folder fun1_test.go and base.go. </p>
  
  <p>The base.go has same common basic functions which are called by fun1_test.go. The base.go looks like:</p>
  
  <pre><code>package mypack_test
  import (
  .....
  )
  
  func Base1() {
      // some code
  }
  </code></pre>
  
  <p>The func1_test.go has functions which test func1. The func1_test.go looks like:</p>
  
  <pre><code>package mypack_test
  import (
  .....
  )
  
  func TestFunc1() {
      // some code
      Base1()
      // some code
  }
  </code></pre>
  
  <p>When I use command</p>
  
  <pre><code>go test func1_test.go base.go
  </code></pre>
  
  <p>There will be an error: </p>
  
  <p>can't load package: package main: found packages mypack (func1_test.go) and mypack_test (base.go)</p>
  
  <p>Can any one tell me why this happend. I know If the change the file base.go to base_test.go. The command will work ok. But I want to know why.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I notice some of you guys misunderstanding the problem. The problem is not about if the two file need the other packages or one can call one.  </p>
  
  <p>The problem is that: If you have <strong>two file</strong> with <strong>same package</strong>, the package name looks like <code>xxx_test</code>.  But the two files' name are <strong>yyy_test.go</strong> and <strong>zzz.go</strong>. When using <code>go test yyy_test.go zzz.go</code> command, there will be an error said they two file not in same packages. </p>
  
  <p>The error are: can't load package: package main: found packages xxx (yyy_test.go) and xxx_test (zzz.go)</p>