英文:
Go requirements.txt for Dockerfile
问题
我需要为我的项目编写一个Dockerfile,其中需要使用很多go get命令来获取外部包。有没有办法获取要导入的外部包的列表?我想知道我需要在Dockerfile中放入哪些外部包。
英文:
I need to write a Dockerfile to my project that needs lots of go gets to external packages.
Is there any way to get a list of external packages to import?
I want to know every external package that I need to put in Dockerfile.
答案1
得分: 1
你可以使用项目cespare/deplist。
go list -f '{{.ImportPath}}' P/... | xargs -n 1 deplist | grep -v P | sort -u
其中
P是部分包路径。
英文:
You can use the project cespare/deplist
Or check this thread which uses go list.
go list -f '{{.ImportPath}}' P/... | xargs -n 1 deplist | grep -v P | sort -u
> with P being the partial package path.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论