Install Go on Linux (Mint) and modify bashrc

I want to install Google Go Language on my Linux Mint. I am new to Linux, so itโ€™s not easy to follow some of the instructions that I read. Namely, I was told to edit / modify the bashrc file:

 export GOROOT=$HOME/gosource
 export GOARCH=amd64
 export GOOS=linux
 export GOBIN=$HOME/bin
 export PATH=$PATH:$GOBIN

I do not know how to do that. I typedgedit ~/.bashrc

a blank page appeared in the terminal. I added the code and saved it. Then did

hg clone -u https://go.googlecode.com/hg/ go

to get the source code. It's right? Since I then tried to compile the code and a long list of errors appeared (which I donโ€™t have, I, unfortunately, use another computer in mo).

But if anyone can help me install Go, I would appreciate it.

DECISION:

Besides the various issues mentioned and resolved in the answers below, I forgot to install the following

sudo apt-get install bison ed gawk gcc libc6-dev make

Which is mentioned at the top of the golang.com installation page.

+3
3

, ~/go ~/.bashrc, $GOROOT ~/gosource.

Go Getting Started. , , ; , enter. $ , . , Linux , / \. ; . , env, pwd, which uname. " ", .

~/.bashrc.

$ gedit ~/.bashrc

export GOROOT=$HOME/go
export GOARCH=amd64
export GOOS=linux
export GOBIN=$GOROOT/bin
export PATH=$PATH:$GOBIN

, , ~./bashrc .

$ env | grep '^\(GO\|HOME=\|PATH=\)'
GOBIN=/home/peter/go/bin
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/peter/go/bin
GOARCH=amd64
HOME=/home/peter
GOROOT=/home/peter/go
GOOS=linux
$ cd $GOROOT/src
$ pwd
/home/peter/go/src
$ uname -a
Linux peter 2.6.32-31-generic #61-Ubuntu SMP Fri Apr 8 18:25:51 UTC 2011 x86_64 GNU/Linux

$GOROOT, .

$ hg clone -u release https://go.googlecode.com/hg/ $GOROOT
requesting all changes
adding changesets
adding manifests
adding file changes
added 8441 changesets with 31916 changes to 4421 files (+1 heads)
updating to branch release-branch.r57
2702 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd $GOROOT/src
$ ./all.bash
< SNIP OUTPUT >
ALL TESTS PASSED
---
Installed Go for linux/amd64 in /home/peter/go.
Installed commands in /home/peter/go/bin.
The compiler is 6g.
$ which 6g
/home/peter/go/bin/6g

, , .

, " Go", "go"; Linux , "Go" "go" .

$GOROOT hg clone $GOROOT , hg clone hg. ,

$ env | grep '^GOROOT'
GOROOT=
$ hg clone -u release https://go.googlecode.com/hg/ $GOROOT
destination directory: hg

GOARCH=amd64, 64- Linux Mint x86_64. uname -a? , 6g 6l x86_64, $GOBIN, $PATH.

$ env | grep '^\(GOBIN\|PATH=\)'
GOBIN=/home/peter/go/bin
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/peter/go/bin
$ which 6g
/home/peter/go/bin/6g

, ./all.bash.

ALL TESTS PASSED
---
Installed Go for linux/amd64 in /home/peter/go.
Installed commands in /home/peter/go/bin.
The compiler is 6g.
+1

gedit /.bashrc

gedit ~/.bashrc

, (?!), , , , gedit root. gedit ( ), , .

0

.

do

cd go/src
./all.bash

Go. , . PATH. Go, , Robin Green.

PS Debian packages for golang have recently been downloaded to unstable (see this error ), so it might be better to capture the source of the package and create a real Debian package from it.

0
source

All Articles