go

programming language

TLDR

Download and install a package, specified by its import path

$ go get [package_path]
copy

Compile and run a source file (it has to contain a main package)

$ go run [file].go
copy

Compile a source file into a named executable

$ go build -o [executable] [file].go
copy

Compile the package present in the current directory

$ go build
copy

Execute all test cases of the current package (files have to end with _test.go)

$ go test
copy

Compile and install the current package

$ go install
copy

Initialize a new module in the current directory

$ go mod init [module_name]
copy

SYNOPSIS

go command [arguments]

DESCRIPTION

The Go distribution includes a command, named go, that automates the downloading, building, installation, and testing of Go packages and commands.

COMMANDS

Each command is documented in its own manpage. For example, the build command is documented in go-build(1). The commands are:

build

compile packages and dependencies

clean

remove object files

doc

run godoc on package sources

env

print Go environment information

fix

run go tool fix on packages

fmt

run gofmt on package sources

get

download and install packages and dependencies

install

compile and install packages and dependencies

list

list packages

run

compile and run Go program

test

test packages

tool

run specified go tool

version

print Go version

vet

run go tool vet on packages

EXAMPLES

TODO

SEE ALSO

go-build(1), go-clean(1).

AUTHOR

This manual page was written by Michael Stapelberg <stapelberg@debian.org>, for the Debian project (and may be used by others).

Copied to clipboard
coinbase