go mod的使用

使用go mod,注意你所使用的go版本应为11以上。
go mod的思想类似于maven:拥抱本地库,使用go mod后,你会发现go modules 下载的包在 GOPATH/pkg/mod。具体使用可查看下面地址。

官网
https://github.com/golang/go/wiki/Modules  

不同管理工具对比
https://github.com/golang/go/wiki/PackageManagementTools

go mod的使用
https://studygolang.com/articles/19010
https://ieevee.com/tech/2018/08/28/go-modules.html?utm_source=tuicool&utm_medium=referral

有些包无法获取,比如:golang.org,google.golang.org,cloud.google.com等,可采用GOPROXY,需要go版本为13以上
https://goproxy.io/

报错并解决
1.module declares its path as: oauth2,but was required as: github.com/llaoj/oauth2
场景:clone 代码(https://github.com/llaoj/oauth2.git)到本地,运行后报错
解决:删除go.mod,go.sum,重新初始化go mod init github.com/llaoj/oauth2,注意观察go.mod的module

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值