<p>I've read a few tutorials about starting up a server using http2 and all of them say you need to import that package in some combination like so:</p>
<pre><code>import (
"fmt"
"html"
"log"
"net/http"
"golang.org/x/net/http2"
)
</code></pre>
<p>But when I try to run any of the samples, I always get this error:</p>
<blockquote>
<p>cannot find package "golang.org/x/net/http2" in any of:</p>
<p>/usr/local/go/src/golang.org/x/net/http2 (from $GOROOT)</p>
<p>/home/doc/go/src/golang.org/x/net/http2 (from $GOPATH)</p>
</blockquote>
<p>I've been off and on with Go for a month and might be forgetting something about including external packages?</p>
<hr/>**评论:**<br/><br/>Bake_Jailey: <pre><p>Did you forget to "go get" the package?</p></pre>nhooyr: <pre><p>Run</p>
<pre><code>go get golang.org/x/net/http2
</code></pre>
<p>then try to import.</p></pre>dhdfdh: <pre><p>Thanks. That was it. I forgot that part.</p></pre>KimIlYong: <pre><p>For a simple server example you could check out my blog entry about http2:
<a href="http://intogooglego.blogspot.co.at/2015/09/day-20-go-http2-server-example.html" rel="nofollow">http://intogooglego.blogspot.co.at/2015/09/day-20-go-http2-server-example.html</a></p></pre>dhdfdh: <pre><p>Had that bookmarked long ago :)</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传