title: To use package properly, how to arrange directory, file name, unit test file?
body: <p>My source files tree is like this:</p>
  
  <pre><code>/src
    /pkg
      /foo
        foo.go
        foo_test.go
  </code></pre>
  
  <p>Inside <code>foo.go</code>:</p>
  
  <pre><code>package foo
  
  func bar(n int) {
      ...
  }
  </code></pre>
  
  <p>inside <code>foo_test.go</code>:</p>
  
  <pre><code>package foo
  
  func testBar(t *testing.T) {
      bar(10)
      ...
  }
  </code></pre>
  
  <p>My questions are:</p>
  
  <ol>
  <li>Does package name relates to directory name, source file name?</li>
  <li>If there is only one source file for a package, need I put it in a directory?</li>
  <li>Should I put <code>foo.go</code> and <code>foo_test.go</code> in the same package?</li>
  <li>In the <code>foo_test.go</code>, as it's in the same package as <code>foo.go</code>, I didn't import <code>foo</code>. But when I compile <code>foo_test.go</code> with 6g, it says <code>bar() is undefined</code>. What should I do?</li>
  </ol>