Golang 如何更新Go mod 中的依赖

引言

在golang中对依赖的更新没有比较舒服的更新方式,比如php中composer的更新依赖就很方便

以下内容可以来处理更新依赖

查看有更新的直接依赖项的方法

go list -u -f '{{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}}{{end}}' -m all

该方法还有变种,比如查看更新的版本信息:

go list -u -f '{{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}}: {{.Version}} -> {{.Update.Version}}{{end}}' -m all

那么如何更新

  • XArgs
go list -u -f '{{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}}{{end}}' -m all | xargs go get -u
  • go get -u
go get -u $(go list -u -f '{{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}}{{end}}' -m all)

给TA打赏
共{{data.count}}人
人已打赏
杂七杂八

Vite+Vue3+Antdv 中设置了按需引入后国际化文件导入504 Getway报错问题处理

2023-2-21 16:30:04

杂七杂八

XArrPay 普通宝塔面板或linux系统进行部署

2023-3-27 14:48:23

0 条回复A文章作者M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索