ref: [url]http://golang.org/doc/install.html[/url]
Install go and say hello
* step1:add variables to PATH
for example:
export GOROOT=/home/eric/program/go
export GOARCH=386
export GOOS=linux
different os,cpu has different value,refer to:[url]http://golang.org/doc/install.html[/url]
make sure user has permission to operate GOROOT folder and create it,if not,install might be fail,
there is another var $GOBIN which is optional,default to $HOME/bin,so you need to create $HOME/bin if not exist,or you can specify it in PATH as above three var(but when I try to specify it,I failed,so I use the default $HOME/bin,of cause I create it first).
* step2: make sure PATH is ok
logout and login so than the PATH change,then use follow commond to test whether PATH is correct:
* step3:Fetch the repository
install mercurial first with follow commond:
get repository with follow commond:
* step4:install some required thing
* step5:install go
If "make all" goes well, it will finish by printing:
--- cd ../test
N known bugs; 0 unexpected bugs
* step6:
you have finish install go on ubuntu9.10, :lol: :arrow:
you might need relogin,I don't need on standalone linux,but need on vmware,
* step7:say hello
hello.go:
compile hello.go,take 386 cpu for example,with other cpu,refer to [url]http://golang.org/doc/install.html[/url]
run it:
"hello,world" here we go,finish!
*
Install go and say hello
* step1:add variables to PATH
for example:
export GOROOT=/home/eric/program/go
export GOARCH=386
export GOOS=linux
different os,cpu has different value,refer to:[url]http://golang.org/doc/install.html[/url]
make sure user has permission to operate GOROOT folder and create it,if not,install might be fail,
there is another var $GOBIN which is optional,default to $HOME/bin,so you need to create $HOME/bin if not exist,or you can specify it in PATH as above three var(but when I try to specify it,I failed,so I use the default $HOME/bin,of cause I create it first).
* step2: make sure PATH is ok
logout and login so than the PATH change,then use follow commond to test whether PATH is correct:
$ env | grep '^GO'
* step3:Fetch the repository
install mercurial first with follow commond:
sudo apt-get install mercurial
get repository with follow commond:
$ hg clone -r release https://go.googlecode.com/hg/ $GOROOT
* step4:install some required thing
$ sudo apt-get install bison gcc libc6-dev ed make
* step5:install go
$ cd $GOROOT/src
$ make all
If "make all" goes well, it will finish by printing:
--- cd ../test
N known bugs; 0 unexpected bugs
* step6:
you have finish install go on ubuntu9.10, :lol: :arrow:
you might need relogin,I don't need on standalone linux,but need on vmware,
* step7:say hello
cd ~
gedit hello.go
hello.go:
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}
compile hello.go,take 386 cpu for example,with other cpu,refer to [url]http://golang.org/doc/install.html[/url]
8g hello.go
8l hello.8
run it:
./8.out
"hello,world" here we go,finish!
*