作者:手机用户2502876217 | 来源:互联网 | 2023-09-10 20:08
1.安装必备的编译环境sudoapt-getinstallbisonlibc6-devedpython-setuptoolspython-devbuild-essentialsud
1. 安装必备的编译环境
sudo apt-get install bison libc6-dev ed python-setuptools python-dev build-essential
sudo easy_install mercurial
2. 用mercurial下载最新go的编译环境
hg clone -r release https://go.googlecode.com/hg/ go
卡住
hg clone -u release https://code.google.com/p/go
suck
主要是因为那堵墙
只能手动到https://code.google.com/p/go下载二进制包
3.
cd go/src
./all.bash
4.
当显示测试用例都正确后,表明go安装成功
5.
设置环境变量:
vim /home/xxxx/.bashrc
export GOROOT=/home/xxxx/cplus/go
export GOARCH=386
export GOOS=linux
export PATH=$PATH:$GOROOT/bin
6.
1 解释执行
go run hello.go
2 编译执行
go build hello.go
./hello