Run

There is a third command that works similarly to build, but also runs the binary. It creates the binary using the build command using a temporary directory as output, and executes the binary on the fly:

$ go run main.go
main output line 1
main output line 2

$

Run can be used over build or install when you're making changes to the source code. If the code is the same, it is probably better to build it once and execute it many times.