LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

go-list

list Go packages and module information

TLDR

List current package
$ go list
copy
List all packages
$ go list ./...
copy
List as JSON
$ go list -json [package]
copy
List with dependencies
$ go list -deps [package]
copy
List modules instead of packages
$ go list -m all
copy
Check for module updates
$ go list -m -u all
copy
Custom format output
$ go list -f '{{.ImportPath}}: {{.Dir}}'
copy

SYNOPSIS

go list [-f format] [-json] [-m] [flags] [packages]

DESCRIPTION

go list displays information about Go packages and modules. It enumerates packages, their source directories, import paths, and dependencies. With -m, it lists modules instead of packages. The -f flag allows custom formatting using Go template syntax with access to package struct fields like ImportPath, Dir, Deps, and GoFiles.

PARAMETERS

-f format

Custom output format using Go template syntax.
-json
Output in JSON format.
-m
List modules instead of packages.
-deps
Include all dependencies.
-e
Include erroneous packages.
-u
Show available updates (with -m).

SEE ALSO

go(1), go-mod(1)

Copied to clipboard
Kai