首页 > 编程语言 > 详细

ubuntu下搭建Go语言(golang)环境

时间:2016-02-06 16:17:59      阅读:153      评论:0      收藏:0      [点我收藏+]

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

技术分享

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

复制代码 代码如下:

sudo apt-get install python-setuptools python-dev build-essential //安装mercurial依赖
sudo easy_install mercurial                                       //安装mercurial

获取go语言包

复制代码 代码如下:
hg clone -r release https://go.googlecode.com/hg/ go

编译安装golang

复制代码 代码如下:

cd go/src
./all.bash

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

复制代码 代码如下:

Installed Go for linux/386 in /home/widuu/source/go
Installed commands in /home/widuu/source/go/bin
*** You need to add /home/widuu/source/go/bin to your PATH.

然后我们弄个文件试试

复制代码 代码如下:

sudo vim hello.go
package main
import "fmt"
func main() {
        fmt.Printf("hello, 微度网络\n")
}
go build hello.go
./hello

输出hello,微度网络

技术分享

ubuntu下搭建Go语言(golang)环境

原文:http://www.jb51.net/article/59400.htm

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!