Mac下安装 Go

来源:互联网 发布:下载的软件连不上网络 编辑:程序博客网 时间:2024/05/21 06:57

到官网下载安装包https://golang.org/dl/,可能需要翻墙。

安装之后把/usr/local/go/bin添加到环境变量

// 打开 ~/.profile,添加下面的内容PATH="/usr/local/go/bin:${PATH}"export PATH

重新打开 Terminal,输入go

go

如果出来一堆东西,就说明成功了

Go is a tool for managing Go source code.Usage:    go command [arguments]The commands are:    build       compile packages and dependencies    clean       remove object files    doc         show documentation for package or symbol    env         print Go environment information    fix         run go tool fix on packages    fmt         run gofmt on package sources    generate    generate Go files by processing source    get         download and install packages and dependencies    install     compile and install packages and dependencies    list        list packages    run         compile and run Go program    test        test packages    tool        run specified go tool    version     print Go version    vet         run go tool vet on packagesUse "go help [command]" for more information about a command.Additional help topics:    c           calling between Go and C    buildmode   description of build modes    filetype    file types    gopath      GOPATH environment variable    environment environment variables    importpath  import path syntax    packages    description of package lists    testflag    description of testing flags    testfunc    description of testing functionsUse "go help [topic]" for more information about that topic.

可以看到 go 命令的用法。

0 0
原创粉丝点击