Say "Hello,world!" with google's go language on ubuntu9.10

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:
 $ 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!

*
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值