Syntax

Go Run a Program Syntax

In Go, run a program: runs or builds Go code — go run . go build

Quick Answer

Syntax
go run . go build
GoSyntax

Run a Program

Code example
go run . go build

Runs or builds Go code.

Learn More

How to run a program in Go

  1. Open your Go file or editor.
  2. Copy the example, then replace its sample names and values for your code.

Go Run a Program Syntax

Use go run . go build.

Related Syntax References

Frequently asked questions

What is the Go syntax for run a program?

Use this pattern: go run . go build

Can I copy this Go code example?

Yes. Use Copy code and adapt the example to your program.

Is this Go syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify