如何删除我意外发布到go.dev的软件包?

huangapple go评论82阅读模式
英文:

How do I delete a package that I accidentally published to go.dev?

问题

我意外地将一个包发布到了go.dev网站上,有人可以告诉我如何删除它吗?

https://pkg.go.dev/github.com/Nksama/Random-quotes

英文:

I accidentally published a package to go.dev website, can anyone tell me how to delete it?

https://pkg.go.dev/github.com/Nksama/Random-quotes

答案1

得分: 8

已发布的模块无法删除,但可以撤回。撤回的版本仍然存在,并且可以下载(这样依赖于它的构建不会中断),但是在解析时,go命令不会自动选择它。更多信息请参见这里

要撤回,您需要在go.mod文件中添加撤回指令。例如:

retract v1.0.0
retract [v1.0.0, v1.9.9]
retract (
    v1.0.0
    [v1.0.0, v1.9.9]
)

请注意:

> 撤回指令是在Go 1.16中添加的。Go 1.15及更低版本将报告错误,如果在主模块的go.mod文件中写入撤回指令,将忽略依赖项的go.mod文件中的撤回指令。

英文:

Published modules cannot be deleted but can be retracted. A retracted version still exists and can be downloaded (so builds that depend on it won't break), but the go command won’t select it automatically when resolving. More info here.

To retract you will have to add retract directive to your go.mod. For example

retract v1.0.0
retract [v1.0.0, v1.9.9]
retract (
    v1.0.0
    [v1.0.0, v1.9.9]
)

Please Note :

> The retract directive was added in Go 1.16. Go 1.15 and lower will
> report an error if a retract directive is written in the main module's
> go.mod file and will ignore retract directives in go.mod files of
> dependencies.

答案2

得分: 1

在网站https://go.dev/about/上有一个软件包移除指南。

基本上,你需要在你的go.mod文件中添加retract指令并发布新版本。

英文:

There's package removal guide on the site: https://go.dev/about/

Basically you need to put retract directive in your go.mod file and publish new version.

huangapple
  • 本文由 发表于 2021年7月31日 14:25:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/68599703.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定