源代码安装go

[b]安装Mercurial[/b]

如何在Ubuntu上安装Mercurial?


[code]
sudo apt-get install python2.5
sudo apt-get install python-all-dev
sudo apt-get install python-setuptools
sudo easy_install -U mercurial
hg --version
[/code]

[b]安装GO[/b]
[code]
hg clone -u release https://code.google.com/p/go ~/dist
cd go/src
./all.bash
[/code]

运行all.bash后,出现“ALL TESTS PASSED” 说明安装成功

在~/.bashrc文件中增加以下

[code]
export GOROOT=~/dist
export GOBIN=$GOROOT/bin
export PATH=$PATH:$GOBIN
[/code]

测试是否可以用命令中运行 #go
[code]
Go is a tool for managing Go source code.

Usage:

go command [arguments]

The commands are:

build compile packages and dependencies
clean remove object files
env print Go environment information
fix run go tool fix on packages
fmt run gofmt on package sources
get download and install packages and dependencies
install compile and install packages and dependencies
list list packages
run compile and run Go program
test test packages
tool run specified go tool
version print Go version
vet run go tool vet on packages

Use "go help [command]" for more information about a command.

Additional help topics:

c calling between Go and C
gopath GOPATH environment variable
importpath import path syntax
packages description of package lists
testflag description of testing flags
testfunc description of testing functions

Use "go help [topic]" for more information about that topic.

[/code]
[b]官方有一种更简单的方式安装[/b]
1.下载go源代码
[code]
wget http://go.googlecode.com/files/go1.2.linux-amd64.tar.gz
[/code]
2.解压到/usr/local 目录下
[code]
tar -C /usr/local -xzf go1.2.linux-amd64.tar.gz
[/code]
3.增加到PATH中
在/etc/profile或者 $HOME/.profile中增加
[code]
export PATH=$PATH:/usr/local/go/bin
[/code]
4.运行go测试是否成功


参考:[url=http://blog.csdn.net/tony1130/article/details/3739695]http://blog.csdn.net/tony1130/article/details/3739695[/url]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值