Is Go compiled or interpreted?
Go is compiled ahead of time to native machine code by its standard compiler. It has no virtual machine, but every Go program carries a runtime that includes a garbage collector.
How it runs your code
The gc compiler turns Go source into machine code and usually links a single static executable. go run compiles your program to a temporary executable and then runs it. The runtime inside the executable schedules goroutines and collects garbage.
Does that make Go slow?
Go's optimizer works before the program runs. In the harness behind this site, Go took 311 ns on our class code and 43 ns on the plain functions, measured with go test and b.Loop.
Questions
Is Go interpreted?
No. Go is compiled ahead of time to machine code.
Does Go have a virtual machine?
No. Go programs run directly on the CPU, but they include a runtime with a garbage collector and a goroutine scheduler.
Why does go run seem like a script?
It compiles your program to a temporary executable, runs it, and then discards it.
Related
Is Rust compiled? · Is C++ compiled? · Is Swift compiled? · Compiled vs interpreted · Why optimization decides speed