GO語言下載、安裝、配置

轉自:http://www.cnblogs.com/zsy/p/5215336.html

一、Go語言下載

go語言官方下載地址:https://golang.org/dl/

QQ圖片20160224204006

找到適合你係統的版本下載,本人下載的是windows版本。也可以下載Source自己更深層次研究go語言。

二、GO語言安裝

下載完成之後,雙擊go1.6.windows-amd64.msi進行安裝。

如果安裝過程出現以下提示:

QQ圖片20160224204435

以管理員的身份運行cmd,找到go1.6.windows-amd64.msi所在的目錄,並輸入msiexec /i go1.6.windows-amd64.msi如下圖(放在D盤根目錄):

QQ圖片20160224205030

步驟一:雙擊運行安裝程序

QQ圖片20160224205126

步驟二:點擊Next,出現License

QQ圖片20160224205243

選擇I accept the terms in the License Agreeement。

步驟三:點擊Next,選擇安裝路徑

image

默認C:\Go\

步驟四:點擊Next進行安裝

image

點擊Install按鈕進行安裝

image

image

步驟五:耐心等待,直到以下界面

image

點擊Finish完成安裝。

三、安裝後目錄說明

Go語言安裝之後,C:\Go目錄下一共有9個目錄與9個文件,如下圖:

image

api — 目錄,包含所有API列表,方便IDE使用

bin— 目錄,存放編譯後的可執行文件

blog— 目錄,

doc— 目錄,幫助文檔

lib— 目錄,

misc— 目錄,

pkg— 目錄,存放編譯後的包文件。pkg中的文件是Go編譯生成的

src— 目錄,存放項目源文件

注:一般,bin和pkg目錄可以不創建,go命令會自動創建(如 go install),只需要創建src目錄即可。

Authors— 文件,作者列表,用記事本打開

CONTRIBUTING.md— 文件,

CONTRIBUTORS— 文件,

favicon.ico— 文件,

LICENSE— 文件,license,用記事本打開

PATENTS— 文件,

README.md— 文件,

robots.txt— 文件,使用robots.txt阻止對網址的訪問,詳情查看https://support.google.com/webmasters/answer/6062608?hl=zh-Hans

VERSION— 文件,版本信息,用記事本打開

四、設置GO環境變量

官方文檔:

If you chose a directory other than c:\Go, you must set the GOROOT environment variable to your chosen path.

Add the bin subdirectory of your Go root (for example, c:\Go\bin) to your PATH environment variable.

Setting environment variables under Windows

Under Windows, you may set environment variables through the "Environment Variables" button on the "Advanced" tab of the "System" control panel. Some versions of Windows provide this control panel through the "Advanced System Settings" option inside the "System" control panel.

具體設置步驟如下(windows 10 企業版):

找到:我的電腦,右鍵,打開“屬性”

image

選擇“高級系統設置”

image

彈出以下對話框,選擇“高級”標籤:

image

點擊“環境變量”按鈕,彈出變量設置窗口:

image

“新建”系統變量:

image

設置變量名GOROOT,變量值C:\Go\(安裝目錄)

修改系統變量Path,添加C:\Go\bin\

image

環境變量設置之後,在命令行中輸入go:

image

image

按回車鍵:

image

如查看version,運行go version

image

五、總結

Go語言安裝比較簡單,安裝成功之後要配置運行環境變量,與java類似。

隨後將繼續Go語言之旅。



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章