Using the go build myprogam.go
produces an executable file, which is what I'm familiar with when working with compilers.
However, using go run myprogram.go
doesn't create any executable files and still runs the program.
How exactly does this work, is the executable created and then deleted or does it run the code like an interpreter would?
A temporary executable is created. The same is the case for go test.
Documentation on go test
The package is built in a temporary directory so it does not interfere with the non-test installation.
You can also run fmt.Println(os.Args[0])
to see the executable file that is being created.