ubuntu下搭建Go語言(golang)環境_Golang

來源:互聯網
上載者:User

Go語言是Google2009發布的第二款開源程式設計語言。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,微度網路

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.