LinuxCommandLibrary

go

TLDR

Run a program

$ go run [main.go]
copy
Build an executable
$ go build
copy
Run tests
$ go test
copy
Download dependencies
$ go mod download
copy
Format code
$ go fmt ./...
copy

SYNOPSIS

go command [arguments]

DESCRIPTION

go is the tool for managing Go source code. It provides commands for building, testing, running, and managing Go programs and modules.
The tool handles compilation, dependency management, testing, and code quality. Go modules provide versioned dependency management. The toolchain is self-contained.
go is the complete development toolchain for the Go language.

PARAMETERS

build

Compile packages and dependencies.
run
Compile and run program.
test
Run tests.
mod
Module maintenance.
get
Download and install packages.
fmt
Format source code.
vet
Report likely mistakes.
doc
Show documentation.
--help
Display help information.

CAVEATS

Requires GOPATH or modules. Cross-compilation built-in. CGO may need additional setup.

HISTORY

Go was created at Google by Robert Griesemer, Rob Pike, and Ken Thompson in 2007, released publicly in 2009.

SEE ALSO

go-build(1), go-run(1), go-mod(1)

Copied to clipboard