如何使用Go模块删除已安装的软件包 [英] How to remove an installed package using go modules

查看:3207
本文介绍了如何使用Go模块删除已安装的软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用go模块(在Go 1.13中进入get)安装了一个软件包,现在我想将其删除.在文档中,与此无关,在

I've installed a package using go modules (go get in Go 1.13) and now I want to remove it. In the documentation there is nothing about this and in go get docu neither.

手动从go.mod中删除软件包无法解决问题,因此仍保留在go.sum中.

Removing the package from go.mod manually doesn't solve the issue so it remains in go.sum.

我应该如何以干净的方式取出包裹?

How should I remove a package in a clean way?

推荐答案

找到了它 https://blog.golang.org/using-go-modules#TOC_7.

go mod tidy

因此,基本上,一旦没有将软件包导入任何软件包中,您就可以执行go mod tidy,它将安全地删除未使用的缺陷.

So basically, once the package is not being imported in any package you can perform a go mod tidy and it will safely remove the unused depencies.

这篇关于如何使用Go模块删除已安装的软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆