Can't import http2 package

xuanbao · · 1374 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I&#39;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 ( &#34;fmt&#34; &#34;html&#34; &#34;log&#34; &#34;net/http&#34; &#34;golang.org/x/net/http2&#34; ) </code></pre> <p>But when I try to run any of the samples, I always get this error:</p> <blockquote> <p>cannot find package &#34;golang.org/x/net/http2&#34; 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&#39;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 &#34;go get&#34; 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

1374 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传