go Verified current stable Not installed? Programming

Go / Show Package Documentation All Symbols

Show Package Documentation All Symbols

Go command to fetch documentation for all symbols in a specified package.

$
Terminal
go doc -all <encoding/json>

When To Use

When needing to understand the public API of a Go package before usage or integration.

Pro Tip

Use `go doc -u` for a unified output with additional examples if available.

Anatomy of Output

Understanding the result

Package encoding/json Package Header

Indicates the package being documented.

JSON represents the JSON format. Package Description

Provides a brief overview of the package functionality.

func Marshal(v interface{}) ([]byte, error) Function Signature

Describes the function available within the package.

Troubleshooting

Common pitfalls

package not found

Solution: Ensure the package is installed and fits your module requirements.

no documentation available

Solution: Check if the package is part of the current module.

Error: Command failed with exit code 1

Solution: Ensure you are connected to the network for online package docs.

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.
<encoding/json>
encoding json
The value supplied for encoding json.
-all
Command Option
Tool-specific option used by this command invocation.

Alternative Approaches

Comparable commands in other tools

Alternative programming tools for the same job.