Your original problem was that your user didn't own the directory 
/usr/local/go1.4 or it contents.   I presume that you named it like that so 
that you could keep different versions of Go in different directories.

I do the same, but I did a little more work at the start, to save a lot of 
time later.  Do the following just once:

Create /usr/local/golang owned by your ordinary user - mine is simon, in 
group simon

- $ sudo mkdir /usr/local/golang

- $ sudo chown simon /usr/local/golang    # use "chown -R" (capital R) if 
the directory already exists

- $ sudo chgrp simon /usr/local/golang      # ditto 

Once that's done, the user simon owns /usr/local/golang and anything in it, 
so that user can create Go distributions in that directory. 

As your ordinary user, create /usr/local/golang/1.4 containing Go 1.4.    
Build it:

$ export GOROOT_FINAL=/usr/local/go

(The first time you do this, that directory may not exist, but that's OK.)

$ cd  /usr/local/golang/1.4

$ ./all.bash

This produces /usr/local/golang/1.4/go containing a Go distribution that 
expects to be stored in /usr/local/go.

Create a file called /usr/local/go which is a soft link to 
/usr/local/golang/1.4/go:

$ sudo ln -s  /usr/local/golang/1.4/go  /usr/local/go

$ ls -l /usr/local/go
lrwxrwxrwx 1 root root 24 May 24  2017 /usr/local/go -> 
/usr/local/golang/1.4/go


You now have a directory /usr/local/go containing a working Go distribution.

Put /usr/local/go/bin in your path.

You only have to do all that once.  From now on, to upgrade to the latest 
version of Go, do this: 

Create a directory in /usr/local/golang and put the latest distribution in 
there.  For version 1.8.3., create /usr/local/golang/1.8.3.

$ export GOROOT_FINAL=/usr/local/go

$ cd  /usr/local/golang/1.8.3

$ ./all.bash

This produces /usr/local/golang/1.8.3/go containing a Go distribution that 
expects to be stored in /usr/local/go.

Remove the soft link:

$ sudo rm /usr/local/go

and create a new one:

$ sudo ln -s /usr/local/golang/1.8.3/go /usr/local/go

(Don't do that too early in the process - you need the link to the old 
distribution to build the new distribution.)

This procedure has a number of advantages - your current version of Go is 
always called /usr/local/go, you don't have to run many commands as root 
and the process of upgrading to the next version is reasonably simple.

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to