What is the difference between go run and go build?

Answer

go run file.go compiles and immediately executes the specified Go file(s) without saving a binary to disk — useful for quick scripts and experimentation. go build compiles the package and writes a binary executable to disk (the current directory by default, named after the module or directory). The binary can then be deployed and executed independently with no Go toolchain required on the target machine. go install is similar to go build but also moves the binary into $GOPATH/bin (or $HOME/go/bin), making it available system-wide.