I am having trouble understanding what the following command does.
go list ./...
When I look at the official documentation https://golang.org/cmd/go/#hdr-List_packages, it is not clear to me what the ./...
argument is telling the command.
I am having trouble understanding what the following command does.
go list ./...
When I look at the official documentation https://golang.org/cmd/go/#hdr-List_packages, it is not clear to me what the ./...
argument is telling the command.
go list
requires an import path for a package and can give you some listing info for the packages matched this way (you may be interested in its -f
flag).
./...
is a wildcard that matches the current folder and all of its subfolders (execute go help packages
to read more about this somewhat hidden feature), and that can be used with all the built-in Go commands.
So go list ./...
can list all the Go packages in the current folder and its sub-folders - you may want to call it from GOPATH
for example.
go list ./...
Here ./
tells to start from the current folder, ...
tells to go down recursively.
go list ...
In any folder lists all the packages, including packages of the standard library first followed by external libraries in your go workspace.