Installing two go releases side-by-side

164 views
Skip to first unread message

aind...@gmail.com

unread,
Dec 14, 2016, 11:58:55 AM12/14/16
to golang-nuts
I currently have the distribution "go version go1.7.1 darwin/amd64" installed. However, I'd like to test my applications on the 1.8 beta. 
  • Is it okay to install another distribution without messing up the environment variables?
  • If I build from source, can I scope the installation to a specific directory? 
  • What is the recommended procedure for having multiple installations side-by-side?

Thank You,
Akhil Indurti

aind...@gmail.com

unread,
Dec 14, 2016, 12:27:49 PM12/14/16
to golang-nuts, aind...@gmail.com
Never mind, I figured it out. As long as I export a separate $GOROOT during compile, it works fine. To sum up, I just
  1. Downloaded and unpacked the source
  2. cd'd into src/. exported $GOROOT_BOOTSTRAP to /usr/local/go (in my case).
  3. run ./all.bash. as long as you don't add the bin directory to PATH, it won't mess it up.

Alper Köse

unread,
Dec 15, 2016, 11:36:47 AM12/15/16
to golang-nuts, aind...@gmail.com

Hi, you can also use docker. 

There are official docker images in docker hub: https://hub.docker.com/_/golang/

As shown in the docker hub page, you can use the command:
docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp golang:1.6 go build

This way you can easily use whichever version you require.

Dave Cheney

unread,
Dec 15, 2016, 4:53:10 PM12/15/16
to golang-nuts
You can build as many different versions of Go as you need by checking the source out into different locations and running the src/make.bash script.

You should not set GOROOT, building from source will encode the correct location into the bin/go tool during the process.

To make life simpler for yourself, add a symlink to the various versions of the go tool you have built, eg.

ln -s $HOME/go1.6/bin/go $HOME/bin/go1.6

Dave

Akhil Indurti

unread,
Dec 15, 2016, 7:24:20 PM12/15/16
to Dave Cheney, golang-nuts
Yeah, I don't set $GOROOT, but $GOROOT_BOOTSTRAP in order to compile.

Symlinking might be a good idea for convenience, but can I use my system-wide $GOPATH to test my src, or do I duplicate that as well.

Thank You



Dave

--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/uqns15dYvDI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dave Cheney

unread,
Dec 15, 2016, 7:39:57 PM12/15/16
to golang-nuts, da...@cheney.net, aind...@gmail.com
You never need to set GOROOT and setting GOROOT will bring you confusing problems to debug in the future.

Thank You


To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.

Caleb Doxsey

unread,
Dec 16, 2016, 7:02:41 AM12/16/16
to golang-nuts, aind...@gmail.com
The easy solution here is gimme.

eval "$(gimme 1.8beta2)"

Downloads and installs go and sets all the environment variables for you.


On Wednesday, December 14, 2016 at 11:58:55 AM UTC-5, aind...@gmail.com wrote:

Seb Binet

unread,
Dec 16, 2016, 7:06:06 AM12/16/16
to Caleb Doxsey, golang-nuts, aind...@gmail.com
On Fri, Dec 16, 2016 at 1:02 PM, Caleb Doxsey <ca...@doxsey.net> wrote:
The easy solution here is gimme.

eval "$(gimme 1.8beta2)"

Downloads and installs go and sets all the environment variables for you.


On Wednesday, December 14, 2016 at 11:58:55 AM UTC-5, aind...@gmail.com wrote:
I currently have the distribution "go version go1.7.1 darwin/amd64" installed. However, I'd like to test my applications on the 1.8 beta. 
  • Is it okay to install another distribution without messing up the environment variables?
  • If I build from source, can I scope the installation to a specific directory? 
  • What is the recommended procedure for having multiple installations side-by-side?

Thank You,
Akhil Indurti

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.

Seb Binet

unread,
Dec 16, 2016, 7:09:16 AM12/16/16
to Caleb Doxsey, golang-nuts, aind...@gmail.com

Francisco Souza

unread,
Dec 16, 2016, 10:36:35 AM12/16/16
to Seb Binet, Caleb Doxsey, golang-nuts, aind...@gmail.com
On Fri, Dec 16, 2016 at 7:05 AM, Seb Binet <seb....@gmail.com> wrote:
>
>
> On Fri, Dec 16, 2016 at 1:02 PM, Caleb Doxsey <ca...@doxsey.net> wrote:
>>
>> The easy solution here is gimme.
>>
>>
>> $ eval "$(gimme 1.8beta2)"
>>
>>
>> Downloads and installs go and sets all the environment variables for you.
>
>
> there's also something happening here:
> https://godoc.org/golang.org/x/build/version/go1.8beta1
> https://godoc.org/golang.org/x/build/version/go1.8beta2

gimme doesn't require go to install go.
Reply all
Reply to author
Forward
0 new messages