Go语言(golang)环境的搭建–ubuntu篇

Go语言(golang)环境的搭建–ubuntu篇

Go语言是谷歌2009发布的第二款开源编程语言。Go语言专门针对 多处理器系统应用程序的编程进行了优化,使用Go编译的程序可以媲美C或C++代码的速度,而且更加安全、支持并行进程。



 

还是我自己的电脑,我自己安装的是ubuntu 12.04版本的,直接介绍安装吧!其实搭建环境很简单!

1 sudo apt-get install bison ed gawk gcc libc6-dev make //安装c语言的扩展包
1 sudo apt-get install python-setuptools python-dev build-essential //安装mercurial依赖
2 sudo easy_install mercurial                                       //安装mercurial

获取go语言包

1 hg clone -r release https://go.googlecode.com/hg/ go

编译安装golang

1 cd go/src
2 ./all.bash

ubuntu到这里其实就安装成功了,要配置PATH了,就是我们的windows里的环境变量

1 Installed Go for linux/386 in /home/widuu/source/go
2 Installed commands in /home/widuu/source/go/bin
3 *** You need to add /home/widuu/source/go/bin to your PATH.
1 export PATH=$PATH:$HOME/go/bin  //包含的是go语言里边的bin的目录地址哦

然后我们弄个文件试试

1 sudo vim hello.go
2 package main
3 import "fmt"
4 func main() {
5         fmt.Printf("hello, 微度网络\n")
6 }
7 go build hello.go
8 ./hello

输出hello,微度网络


 

转载请注明:微度网络 » Go语言(golang)环境的搭建–ubuntu篇

猜你喜欢

转载自stephen830.iteye.com/blog/2093469