Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Golang requirements.txt equivalent

Tags:

shell

go

revel

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 requirements | 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?

like image 355
mangoman Avatar asked Aug 28 '13 06:08

mangoman


People also ask

How can I get requirements for txt Jupyter?

Simply open a terminal and navigate to the folder you want your requirements file to be in. You can then activate a virtual environment using venv or conda. It will take every package you have installed on that environment.

What is Requirements txt pip?

Requirements files serve as a list of items to be installed by pip, when using pip install. Files that use this format are often called “pip requirements. txt files”, since requirements. txt is usually what these files are named (although, that is not a requirement).

How do I run a requirements txt in Visual Studio?

With your chosen environment selected using the Python: Select Interpreter command, run the Terminal: Create New Terminal command (Ctrl+Shift+`)) to open a terminal with that environment activated. In the terminal, run pip freeze > requirements. txt to create the requirements. txt file in your project folder.


1 Answers

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:

https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them

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.

They also provide useful blog posts, https://blog.golang.org/using-go-modules

like image 160
Volker Avatar answered Oct 06 '22 13:10

Volker