快速搭建golang环境 (Windows + Linux)

本文详细介绍了如何在Linux和Windows系统上安装和配置Go 1.16.2版本,包括设置环境变量 GOPATH、GOPROXY 和 GO111MODULE。同时推荐了JetBrains的Goland作为IDE。

Linux

下载版本1.16.2,并配置env

$ wget -c https://dl.google.com/go/go1.16.2.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
$ sed -i '$a\export PATH=$PATH:/usr/local/go/bin' ~/.bash_profile
$ sed -i '$a\export GO111MODULE=on' ~/.bash_profile
$ sed -i '$a\export GOPROXY=https://goproxy.cn,direct' ~/.bash_profile
$ source ~/.bash_profile
$ go version
go version go1.16.2 linux/amd64

Windows10

golang下载地址
https://golangdocs.com/install-go-windows

set envs

$ go env -w GO111MODULE=on
$ go env -w GOPROXY=https://goproxy.cn,direct
$ go env -w GOPATH=D:\golang

IDE,推荐Jetbrains的Goland
https://www.jetbrains.com/go/
https://blog.jetbrains.com/go/2019/01/22/working-with-go-modules/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值