title: How to use "internal" packages?
body: <p>I try understand how to organize go code using "internal" packages. Let me show what the structure I have:</p>
  
  <pre><code>project/
    internal/
      foo/
        foo.go # package foo
      bar/
        bar.go # package bar
    main.go
  
  # here is the code from main.go
  package main
  
  import (
    "project/internal/foo"
    "project/internal/bar"
  )
  </code></pre>
  
  <p><code>project/</code> is outside from GOPATH tree. Whatever path I try to import from <code>main.go</code> nothing works, the only case working fine is <code>import "./internal/foo|bar"</code>. I think I do something wrong or get "internal" package idea wrong in general. Could anybody make things clearer, please?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>The example above is correct the only what I need was to place <code>project/</code> folder under <code>$GOPATH/src</code>. So the thing is import path like the <code>project/internal/foo|bar</code> is workable if we only import it from <code>project/</code> subtree and not from the outside.</p>