Run multiple go version on one machine

blov · · 748 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I want to test something with 1.5 version , but i don&#39;t want to upgrade my machine . Is that possible or should i run a VM for the 1.5 version ?</p> <hr/>**评论:**<br/><br/>brokedown: <pre><p>Check out &#39;gvm&#39; on github. It makes it easy to install multiple versions and pick which one you want to use.</p></pre>Ariemeth: <pre><p>To save the time to search github: <a href="https://github.com/moovweb/gvm">https://github.com/moovweb/gvm</a> </p></pre>evanlin1007: <pre><p>If you use Mac OSX, the best way to switch golang is using <code>brew switch</code>.</p> <p>Just <code>brew switch go1.5</code> or <code>brew switch go1.4.2</code> to quick switch golang version without any extra setting.</p></pre>Ariemeth: <pre><p>There are a few ways to do this. You could install go 1.5 in a different folder and change your GOROOT variable to point to the new location. You could always rename your current go location to something like go-old and put 1.5 in go. Not the most sophisticated, but it works.</p></pre>ekalinin: <pre><p>He&#39;s my try - analogue for python&#39;s virtualenv, but for any language including golang: *<a href="https://github.com/ekalinin/envirius" rel="nofollow">https://github.com/ekalinin/envirius</a> </p></pre>peterhellberg: <pre><p>I’ve been using <a href="https://github.com/travis-ci/gimme" rel="nofollow">https://github.com/travis-ci/gimme</a> in order to switch between 1.4.2 and 1.5 (and the beta/rc releases before the final release)</p> <p>Works just fine under both OS X and Linux.</p></pre>nyoungman: <pre><p>Right now I&#39;m using Go 1.5 primarily, but if I want to test something against 1.4 I have a simple alias setup:</p> <p>alias go14=&#34;/Users/nathany/src/go.googlesource.com/go1.4/bin/go&#34;</p> <p>Of course that doesn&#39;t cover all the other tools. Also note, I&#39;ve installed from source, as I like to keep tabs on new developments.</p></pre>Sphax: <pre><p>I simple have the two versions in two different directories and link the go/godoc command to /usr/bin and done.</p></pre>hipone: <pre><p>Assuming you run currently 1.4, put the dist under $USER/go1.4, wget 1.5 dist and put it under $USER/go1.5, make a $USER/go symlink to the version you want to use; obviously add $USER/go/bin to your PATH.</p></pre>

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

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