英文:
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?
答案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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论