安装Golang的步骤

记录Go安装步骤。

1. [参考]安装步骤

2. 安装自制软件

家酿的详细信息可以在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)"

从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

你好,世界。

vim hello.go
    /* CSS declarations go here */

    package main
    import "fmt"

    func main(){
        fmt.Printf("hello world\n")
    }

go run hello.go
hello world
广告
将在 10 秒后关闭
bannerAds