You need the Go toolchain to run Go code on your local computer. Once it's set up, go run lets you run code directly, and go build produces an executable file.
go
# Check Go installation
go version
# Run a Go file directly
go run hello.go
# Build an executable file
go build hello.gogo version checks whether Go was installed successfully. go run hello.go compiles and runs in one step, and go build hello.go produces an executable binary you can run later.
You should see
go version go1.xx.x ... Hello, Go!Info
As your project grows, go mod init project-name starting a module with it becomes important for managing dependencies.