Golang - Difference between "go run main.go" and compilation

'go install' command will create shared library compiled file as package.a under pkg folder and exec file under bin directory.

go run command is useful while doing development as it just compiles and run it for you but won't produce binaries in pkg folder and src folder


go run is just a shortcut for compiling then running in a single step. While it is useful for development you should generally build it and run the binary directly when using it in production.