GO語言下載、安裝、配置

1、Go語言下載

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

QQ圖片20160224204006

找到適合你係統的版本下載,本人下載的是windows版本。也能夠下載Source本身更深層次研究go語言。golang

2、GO語言安裝

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

若是安裝過程出現如下提示:windows

QQ圖片20160224204435

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

QQ圖片20160224205030

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

QQ圖片20160224205126

步驟二:點擊Next,出現License

QQ圖片20160224205243

選擇I accept the terms in the License Agreeement。ide

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

image

默認C:\Go\this

步驟四:點擊Next進行安裝

image

點擊Install按鈕進行安裝google

image

image

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

image

點擊Finish完成安裝。spa

3、安裝後目錄說明

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— 文件,版本信息,用記事本打開

4、設置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

5、總結

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

隨後將繼續Go語言之旅。

相關文章
相關標籤/搜索