We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Go Run

The go run command quickly compiles and runs a Go package. The compiled binary is not saved in your working directory.

I typically use go run to do local testing, scripting and debugging.

Assignment

Conventionally, the file in the main package that contains the main() function is called main.go.

package main

import "fmt"

func main() {
	fmt.Println("hello world")
}
go run main.go

Run and submit the CLI tests from the root of the main package.

Tips

You can execute go help run in your shell to rtfm.