go語言官方下載地址:https://golang.org/dl/java
找到適合你係統的版本下載,本人下載的是windows版本。也能夠下載Source本身更深層次研究go語言。golang
下載完成以後,雙擊go1.6.windows-amd64.msi進行安裝。web
若是安裝過程出現如下提示:windows
以管理員的身份運行cmd,找到go1.6.windows-amd64.msi所在的目錄,並輸入msiexec /i go1.6.windows-amd64.msi以下圖(放在D盤根目錄):api
選擇I accept the terms in the License Agreeement。ide
默認C:\Go\this
點擊Install按鈕進行安裝google
點擊Finish完成安裝。spa
Go語言安裝以後,C:\Go目錄下一共有9個目錄與9個文件,以下圖:命令行
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— 文件,版本信息,用記事本打開
官方文檔:
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.
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 企業版):
找到:個人電腦,右鍵,打開「屬性」
選擇「高級系統設置」
彈出如下對話框,選擇「高級」標籤:
點擊「環境變量」按鈕,彈出變量設置窗口:
「新建」系統變量:
設置變量名GOROOT,變量值C:\Go\(安裝目錄)
修改系統變量Path,添加C:\Go\bin\
環境變量設置以後,在命令行中輸入go:
按回車鍵:
如查看version,運行go version
Go語言安裝比較簡單,安裝成功以後要配置運行環境變量,與java相似。
隨後將繼續Go語言之旅。