goインストール手順をメモ
1.[参考]インストール手順
2. homebrewをインストール
homebrewの詳細はhttps://liginc.co.jp/web/tool/mac-iphone/151069
ruby -e "$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)”
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew list
brew update
参考 unsitallコマンド
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
3.homebrewからgoをインストール
brew search go
brew install go
go version
go version go1.7 darwin/amd64
4.環境変数設定
vim .bash_profile
export GOROOT="go env GOROOT" or "/usr/local/opt/go/libexec"
export GOPATH=$HOME/dev/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
source .bash_profile
go version
go version go1.7 darwin/amd64
5.hello world を確認
vim hello.go
/* CSS declarations go here */
package main
import "fmt"
func main(){
fmt.Printf("hello world\n")
}
go run hello.go
hello world