Search⌘ K

Building and Running Go-Programs

Explore how to build and run Go programs using commands like go build, go run, and go install. Understand compiler error messages and how to handle runtime errors. Learn to compile all Go files in a directory with batch scripts to streamline your development workflow.

The go command

To compile and link a go program test.go, use:

go build test.go

If you want to compile, link and run the program, use:

go run test.go

where the executable binary is stored in the cache. If you want to compile, link and install the package pack1, use:

go install pack1

To remove ...