go Verified current stable Not installed? Programming

Go / List Standard Packages

List Standard Packages

Lists all standard Go packages available for import.

$
Terminal
go list std

When To Use

When assessing available libraries during code refactoring or architecting new features.

Pro Tip

Use the pattern `go list std/...` to list all packages hierarchically, optimizing large projects.

Anatomy of Output

Understanding the result

fmt /usr/local/go/src/fmt First Column - Package Name

Name of the standard package.

/usr/local/go/src/fmt Second Column - Package Path

Filesystem path to the package source.

Power User Variants

Optimized versions

go list std -json

Provides detailed JSON output of all standard packages.

go list std --export

Outputs exported symbols of each package.

Troubleshooting

Common pitfalls

go: cannot find package

Solution: Ensure your Go environment is properly set up and GOPATH is correct.

no Go files in directory

Solution: Navigate to a directory containing Go files or initialize a module.

go: no standard packages found

Solution: Check your Go installation for correctness.

Command Breakdown

What each part is doing

go
Base Command
The executable that performs this operation. Here it runs Go before the shell applies any redirect operators.

Alternative Approaches

Comparable commands in other tools

Alternative programming tools for the same job.