1. Open the package file you downloaded and follow the prompts to install Go.

    The package installs the Go distribution to /usr/local/go. The package should put the /usr/local/go/bin directory in your PATH environment variable. You may need to restart any open Terminal sessions for the change to take effect.

  2. Verify that you've installed Go by opening a command prompt and typing the following command:
    $ go version
    
  3. Confirm that the command prints the installed version of Go.

3 配置GOROOT、GOPATH、PATH
编辑文件

export GOROOT="/usr/local/Cellar/go/1.15.3/libexec"
export GOPATH="/Users/apple/doc/GoProjects"
export PATH="/Users/apple/doc/GoProjects/bin:$PATH"
export GO111MODULE=on
export GOPROXY=https://mirrors.aliyun.com/goproxy/
 


GOROOT
go 安装目录,此处brew安装,进入go目录之后可看到bin目录是在libexec下面
如果是源码,可以按照习惯直接复制到/usr/local/go下面,那么此时GOROOT 为/usr/local/go

GOPATH
go的工作目录,即写代码位置。也可以配置$HOME来配置。

安装上述编辑好.bash_profile文件好保存退出,执行命令

source.  .bash_profile

# 亲测 goproxy.io 有些包不全
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct

# 设置不走 proxy 的私有仓库,多个用逗号相隔(可选)
go env -w GOPRIVATE=*.oa.com

# Go 给的默认值,Q 外没问题
go env -w GOPROXY=direct
go env -w GOSUMDB=off

# GOPROXY CN 亲测包全一点
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct

liteide配置:

http://liteide.org/en/doc/install/

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐