# display useful information about $GOPATH
go help gopath
# Lists all available packages inside $GOPATH
# OR All packages inside current module
# if env variable GO111MODULE=on
go list all
# Lists all std lib packages and its sub packages
# Works the same as `go list all`
go list std
# Lists all cmd packages and its sub packages
# Works the same as `go list all`
go list cmd
# Lists all available local packages in CWD
go list ./...
# Lists all imported (local) packages in a JSON format
go list -json ./...
# Displays useful information about import paths
go help importpath
Back to Go Basics