Golang equivalent of npm install -g

If I had a compiled Golang program that I wanted to install such that I could run it with a bash command from anywhere on my computer, how would I do that? For example, in nodejs

npm install -g express

Installs express such that I can run the command

express myapp

and express will generate a file directory for a node application called “myapp” in whatever my current directory is. Is there an equivalent command for go? I believe now with the “go install” command you have to be in the directory that contains the executable in order to run it

Thanks in advance!

What is the equivalent of this with Go? I have a few imports and don’t want people to have to manually install it if they use my package.

You don’t have to do anything. People will not have to manually install the packages you import. When someone does

go get github.com/FrickeFresh/awesome

all of the dependencies you import in your awesome package will be downloaded automatically as needed.

Go get skips testing files by default, but a user can download those too by including -t:

go get -t github.com/FrickeFresh/awesome

But that’s not something you need to worry about.

If you want to delve into vendoring specific versions of dependencies, there are a number of articles/tools available. The official tool is dep: