Golang官網下載
選擇符合自己平台的安裝檔,下載完成後進行安裝。
安裝完畢後,輸入go指令,查看是否有安裝成功。
✗ go version
go version go1.x.x darwin/amd64
✗ go
Go is a tool for managing Go source code.
Usage:
go <command> [arguments]
The commands are:
bug start a bug report
build compile packages and dependencies
clean remove object files and cached files
doc show documentation for package or symbol
env print Go environment information
fix update packages to use new APIs
fmt gofmt (reformat) package sources
編輯.bash_profile,設定go環境變數參數
export GOROOT=$HOME/dev/go1.11
export GOPATH=$HOME/dev/godev
export PATH=$PATH:$GOPATH/bin:$GOROOT/bin
更新環境變數的設定
✗ source .bash_profile
查看環境變數
✗ go env