url to download package?

We can download gem package by https://rubygems.org/downloads/{name}-{version}.gem, cargo creates by https://crates.io/api/v1/crates/{name}/{version}/download. We can download download package directly by this url.

Is there any url to download the go package directly from it if we don’t have the version number??

If you know the version of the go package then you can download it in zip format using this URL format.

e.g. https://proxy.golang.org/github.com/sirupsen/logrus/@v/v1.6.0.zip

As of my knowledge, you can’t download without mentioning the version number. But you can get the list of available versions.


You can also get the latest version like this.


If you want to know more about proxy.golang.org then type this command in your terminal.

$ go help goproxy

@zkmrgirish I think you are right but go get github.com/sirupsen/logrus somehow able to detect the latest version, download it and install it. How github.com/sirupsen/logrus is able to do so??

@rpotter12 Well you were asking for URL and based on the examples given, I gave the answer. :slight_smile:

Here are docs from go help module-get

For each named package or package pattern, get must decide which version of
the corresponding module to use. By default, get looks up the latest tagged
release version, such as v0.4.5 or v1.2.3. If there are no tagged release
versions, get looks up the latest tagged pre-release version, such as
v0.0.1-pre1. If there are no tagged versions at all, get looks up the latest
known commit. If the module is not already required at a later version
(for example, a pre-release newer than the latest release), get will use
the version it looked up. Otherwise, get will use the currently
required version.

When go get can not find any tag to find the version then it uses the latest commit for the latest version. In this case, the version go get uses is v0.0.0-{commit-time}-{commit-id} (I am not 100% sure about this but, it uses commit time and id that is for sure)