Golang requirements.txt equivalent

懵懂的女人 提交于 2019-12-06 18:42:13

问题


Coming from a python/django world, it'd be great to have something like a requirements.txt equivalent for go/revel. How can I do this? I know I can just write a requirements.txt file and then do something like

cat reqiurements.txt | xargs go get

But what if my requirements ALSO have requirements? The above command would attempt to "go get" them, and then they'd fail to build, since I don't have those requirements installed.

Is there something I'm missing?


回答1:


The command go get does exactly what you need: It finds all dependencies and downloads and installs the missing ones. Focus on "all": go get really traverses your dependency graph.

Have a look at the documentation:

http://golang.org/cmd/go/#hdr-Download_and_install_packages_and_dependencies

The Go documentation is really clean, short and well written. I would recommend always to have a look at the documentation first before making assumptions which are based on experience with other tools or tool-chains.




回答2:


I just found that the kubernetes guys actually have created an overview page for themselves here.

Summary is this: Currently stable is Glide and the cool new toy is called dep



来源:https://stackoverflow.com/questions/18481204/golang-requirements-txt-equivalent

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!