mac安装go

一、安装go

brew install go

二、配置

cd ~
vi .zshrc
# go
export GOROOT=/usr/local/opt/go/libexec
export GOPATH=$HOME/.go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

保存关闭
三、测试

vi hello.go
// hello.go
package main
import "fmt"

func main() {
  fmt.Printf("Hello, world!")
}

运行

go run hello.go

猜你喜欢

转载自blog.csdn.net/andysongjinqiang/article/details/81020045