Is there a way to update Go through go get?

agolangf · · 481 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I&#39;m running go on Raspbian, and because debian is right now in a freeze, no new packages are being added, so go is still on 1.7.4 (and <a href="https://golang.org/dl/" rel="nofollow">https://golang.org/dl/</a> doesn&#39;t support ARM).</p> <p>I remember that I was able to get RC builds through go get. Can I get full release that way?</p> <hr/>**评论:**<br/><br/>kostix: <pre><p>You can just use <code>git-buildpackage</code> to build <code>golang-1.8</code> packages out of the official Debian repository (see the <a href="https://tracker.debian.org/pkg/golang" rel="nofollow">package&#39;s page</a>).</p> <p>Basically, you do:</p> <pre><code># apt install git-buildpackage $ gbp clone git://anonscm.debian.org/pkg-golang/golang.git $ git checkout -b golang-1.8 origin/golang-1.8 $ git buildpackage -uc -us -b </code></pre> <p>…and then install the resulting Debian package(s).</p> <p>I&#39;m routinely doing this to have &#34;almost up-to-date&#34; Go packages on the Debian systems at my $dayjob. The only addition step I pefrorm is running</p> <pre><code>$ dch --bpo </code></pre> <p>before building — to add an entry to the package&#39;s log file indicating the package is backported, and then add the <code>--git-ignore-new</code> to the call to <code>git buildpackage</code> to make it not bark on the changed but not committed <code>debian/changelog</code> file.</p></pre>ChristophBerger: <pre><p>Thanks for sharing this! </p> <p>Between checkout and buildpackage, I guess there should be a step that builds the Go distribution from the sources? </p> <p>I ask this becasue I get this error on the <code>git buildpackage</code> step (on a Bananian Pi BTW):</p> <pre><code>gbp:error: Couldn&#39;t checkout &#34;golang-1.8_1.8.orig.tar.gz&#34;: execution failed: [Errno 2] No such file or directory </code></pre></pre>kostix: <pre><p>Ah, no, I think this has something to deal with automagical creation of &#34;upstream source tarballs&#34; which are still required to properly build a Debian package even though they are typically not directly stored in a package&#39;s Git repository.</p> <p>Try doing</p> <pre><code># apt install pristine-tar </code></pre> <p>and then re-clone using</p> <pre><code>$ gpb clone --pristine-tar git://anonscm.debian.org/pkg-golang/golang.git </code></pre> <p>(I think the option <code>--pristine-tar</code> is not actually needed as it&#39;s assumed to be the default but …well, I&#39;d put it there to be on the safe side for sure.)</p></pre>ChristophBerger: <pre><p>Thanks a lot, this eliminated the error. I now observe some missing dependencies (fakeroot etc) but I&#39;ll figure that out. </p></pre>allowthere: <pre><p>Same segfault :(</p></pre>ChristophBerger: <pre><p>The option of installing a complete Go env through go get is new to me.</p> <p><a href="https://golang.org/doc/install/source" rel="nofollow">Installing from source</a> could be a solution.</p></pre>allowthere: <pre><p>Tried that, segfaults in </p> <h5>../misc/cgo/testplugin</h5> <p>./test.bash: line 34: 21001 Segmentation fault LD_LIBRARY_PATH=$(pwd) ./host 2017/03/17 Failed: exit status 139</p></pre>ChristophBerger: <pre><p>Maybe try the steps described by <a href="/u/kostix" rel="nofollow">/u/kostix</a>. </p></pre>kostix: <pre><p>You might consider bringing this up on the <a href="https://groups.google.com/d/forum/golang-nuts" rel="nofollow">golang-nuts mailing list</a> or go straight to the <a href="https://github.com/golang/go/issues/" rel="nofollow">bug tracker</a>.</p> <p>I&#39;d recommend to chime in on the mailing list first.</p> <p>Be sure to pefrorm a clean build in a reasonably clean environment (that is, make sure you don&#39;t have autogenerated files in your checkout, you did not have the <code>GOROOT</code> env. var. set etc), and include the error output to your mail.</p></pre>allowthere: <pre><p>Yup, looks like it&#39;s only for beta:</p> <p><a href="https://godoc.org/golang.org/x/build/version" rel="nofollow">https://godoc.org/golang.org/x/build/version</a></p></pre>jeffrallen: <pre><p>It can be made to work for final releases too:</p> <pre><code>$ go get github.com/jeffallen/build/version/go1.8 $ go1.8 version go1.8: not downloaded. Run &#39;go1.8 download&#39; to install to /home/jra/sdk/go1.8 $ go1.8 download ... Success. You may now run &#39;go1.8&#39; $ go1.8 version go version go1.8 linux/amd64 </code></pre> <p>I don&#39;t know why the Go team does not support this, maybe no one has asked for it. I like it and use it for my own installs.</p> <p>-jeff</p></pre>flemeur: <pre><p>Maybe try godeb? <a href="https://github.com/niemeyer/godeb" rel="nofollow">https://github.com/niemeyer/godeb</a></p> <p>I use it to install the latest go version as a debian package, but i&#39;m not entirely sure if it supports ARM</p></pre>kostix: <pre><p>Looks like <a href="https://golang.org/doc/go1.8#ports" rel="nofollow">Rpi&#39;s ARMs are supported on 1.8</a>.</p></pre>titpetric: <pre><p>Guys, somebody should add Docker to the list. All it takes is a &#39;docker run&#39; command and you can have any version from Docker Hub, of which there are many many.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

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