Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the `...` mean in go get

Tags:

go

I wanted to install gb

The installation steps says to execute the command:

go get github.com/constabulary/gb/...

What does the ... mean in this case?

like image 990
Sundar Avatar asked Aug 11 '15 09:08

Sundar


People also ask

What is U in Go get?

You would use -u to update the dependencies to their latest available minor and patch versions. So if your module is using package foo.com/bar , running go get -u foo.com/bar will update not only foo.com/bar to the latest MINOR.

What is GO111MODULE on?

GO111MODULE is an environment variable that can be set when using go for changing how Go imports packages. One of the first pain-points is that depending on the Go version, its semantics change.

Do we still need Gopath?

Since 1.12 version Go modules is enabled by default and the GOPATH will be deprecated in 1.13 version. For those who are getting started with Go 1.12, the installation and set up goes will be as follows.

What is Go mod vendor?

The go mod vendor command constructs a directory named vendor in the main module's root directory that contains copies of all packages needed to support builds and tests of packages in the main module. Packages that are only imported by tests of packages outside the main module are not included.


1 Answers

The ... (ellipsis) tells go get to also fetch the package's subpackages/dependencies.

From go help packages:

An import path is a pattern if it includes one or more "..." wildcards, each of which can match any string, including the empty string and strings containing slashes. Such a pattern expands to all package directories found in the GOPATH trees with names matching the patterns. As a special case, x/... matches x as well as x's subdirectories. For example, net/... expands to net and packages in its subdirectories.

For an example of how you'd use it, check out this answer.

like image 178
Wander Nauta Avatar answered Sep 22 '22 09:09

Wander Nauta