<p dir="auto"><em>Copying from golang-dev</em></p>
<p dir="auto">The <a href="https://docs.google.com/document/d/1Bz5-UB7g2uPBdOx-rw5t9MxJwkfpx90cqG9AFL0JAYo/edit" rel="nofollow">vendor specification</a> doesn't seem to speak much about the visibility of the vendored packages. Thus, should vendor be treated in similar ways to internal?</p>
<p dir="auto">As it currently is, the following program compiles under go1.6beta2 (with the vendor experiment on):</p>
<div class="highlight highlight-source-go notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="package main

import &quot;vendor/golang.org/x/net/http2/hpack&quot;

func main() {
    hpack.NewEncoder(nil)
}"><pre class="notranslate"><span class="pl-k">package</span> main

<span class="pl-k">import</span> <span class="pl-s">"vendor/golang.org/x/net/http2/hpack"</span>

<span class="pl-k">func</span> <span class="pl-en">main</span>() {
    <span class="pl-s1">hpack</span>.<span class="pl-en">NewEncoder</span>(<span class="pl-c1">nil</span>)
}</pre></div>
<p dir="auto">Is this expected behavior? It seems kind of odd that I can import hpack as part of the "standard" library.</p>
<p dir="auto">This is related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="126779113" data-permission-text="Title is private" data-url="https://github.com/golang/go/issues/13961" data-hovercard-type="issue" data-hovercard-url="/golang/go/issues/13961/hovercard" href="https://github.com/golang/go/issues/13961">#13961</a> and <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="126318187" data-permission-text="Title is private" data-url="https://github.com/golang/go/issues/13929" data-hovercard-type="issue" data-hovercard-url="/golang/go/issues/13929/hovercard" href="https://github.com/golang/go/issues/13929">#13929</a>.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$go version
go version go1.5 darwin/amd64"><pre class="notranslate"><code class="notranslate">$go version
go version go1.5 darwin/amd64
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$uname -a
Darwin TonydeMacBook-Air-2.local 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64"><pre class="notranslate"><code class="notranslate">$uname -a
Darwin TonydeMacBook-Air-2.local 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64
</code></pre></div>
<p dir="auto">the project layout is below: (GOPATH=/home/bigwhite/gotestinternal)</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/home/bigwhite/gotestinternal
└── src
    ├── mypkg
    │   ├── internal
    │   │   └── foo
    │   │       └── foo.go
    │   ├── main.o
    │   └── pkg1
    │       ├── main
    │       └── main.go
    └── otherpkg
        └── main.go"><pre class="notranslate"><code class="notranslate">/home/bigwhite/gotestinternal
└── src
    ├── mypkg
    │   ├── internal
    │   │   └── foo
    │   │       └── foo.go
    │   ├── main.o
    │   └── pkg1
    │       ├── main
    │       └── main.go
    └── otherpkg
        └── main.go
</code></pre></div>
<p dir="auto">I am trying to test the internal package in go 1.5 final release. according to the internal design doc, if we import internal/foo in mypkg/main.go or mypkg/pkg1/main.go, it is ok. but if we import mypkg/internal/foo in otherpkg/main.go， it should be invalid.</p>
<p dir="auto">But the test result is not as the above:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="//otherpkg/main.go
package main

import &quot;mypkg/internal/foo&quot;

func main() {
    foo.Foo()
}"><pre class="notranslate"><code class="notranslate">//otherpkg/main.go
package main

import "mypkg/internal/foo"

func main() {
    foo.Foo()
}
</code></pre></div>
<p dir="auto">we build otherpkg/main.go in otherpkg directory, but no error occurs. It is not the result expected.<br>
but go list -json tell us we has a not-allowed use of internal package：</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;DepsErrors&quot;: [
        {
            &quot;ImportStack&quot;: [
                &quot;otherpkg&quot;,
                &quot;mypkg/internal/foo&quot;
            ],
            &quot;Pos&quot;: &quot;&quot;,
            &quot;Err&quot;: &quot;use of internal package not allowed&quot;
        }
    ]"><pre class="notranslate"><code class="notranslate">"DepsErrors": [
        {
            "ImportStack": [
                "otherpkg",
                "mypkg/internal/foo"
            ],
            "Pos": "",
            "Err": "use of internal package not allowed"
        }
    ]
</code></pre></div>
<p dir="auto">I'm not sure whether it is a problem of go1.5.</p>