Go
Run Commands
Quickly compile and run Go programs without creating a binary. Ideal for development, scripting, and testing small programs during the development cycle.
7 commands
Pro Tips
Use 'go run .' to run the main package in the current directory — no need to specify the file.
Pass args after the file: 'go run main.go -flag value' — Go separates its flags from your program's.
Use 'go run -race .' to enable the race detector during development — catches concurrency bugs early.
Common Mistakes
'go run' compiles every time. For frequently-run programs, use 'go build' once and execute the binary.
The race detector (-race) adds overhead and slows execution. Don't enable it in production benchmarks.