Please enable Javascript to view the contents

安装golang

 ·  ☕ 1 分钟 · 👀... 阅读

Mac安装

如果已经安装了brew,就可以快速安装了

# 安装git
brew install git

# 安装go
brew install go

# add GOBIN path to your PATH in ~/.zshrc
export GO111MODULE=on
export GOPROXY=https://goproxy.cn
export GOPATH="/Users/ysicing/go" # 示例
export GOBIN="$GOPATH/bin"
export PATH=$HOME/bin:/usr/local/bin:/usr/local/opt/mysql-client/bin:$GOBIN:$PATH

配置Visual Studio Code Editor

快捷键cmd+shift+p
键入: go install
选择 "Go: Install/Update Tools"
Check all the checkboxes

Linux安装

访问 golang中国 获取最新go版本

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# 下载
wget https://dl.google.com/go/go1.14.3.linux-amd64.tar.gz
# 解压
tar -C /usr/local -xzf go1.14.3.linux-amd64.tar.gz
# 配置 .bashrc
export GO111MODULE=on
export GOPROXY=https://goproxy.cn
export GOPATH="/root/go"
export GOBIN="$GOPATH/bin"
export PATH=$PATH:$GOBIN:/usr/local/go/bin
source .bashrc
# 验证
go env

一键脚本

1
curl https://ysicing.me/hack/install/go.sh | bash
分享

ysicing
作者
ysicing
云原生爱好者


目录