Go Tool
Internal
Overview
go
is a command line tool with multiple uses: package manager, build tool and test driver. go
manage packages in workspaces, query metadata about packages, print documentation, build, format, download, test, etc.
Commands
Help
go help <command>
go help build
build
The build
command compiles one or more packages and builds the executable if the package main
is among the compiled packages. The tool is sensitive to GOPATH mode. For more details, see:
run
The run
command compiles the specified packages or files by delegating to go build
and then runs the executable. There must be a main
for an executable to be generated.
cd $PROJECT_DIR
go run ./src/main/main.go
install
doc
The doc
command prints documentation for a package.
fmt
The fmt
("format") command formats source code files.
get
The get
command downloads packages and installs them.
list
The list
command lists all installed packages.
test
The test
command runs tests. For more details, see:
env
The env
command prints the effective values of the environment variables relevant to the tool chain.
go env GOOS GOARCH GOPATH
get
The get
command retrieve and update packages.
TODO Addison-Wesley The Go Programming Language Section 10.7.2