go run

suggest change

go run will run a program without creating an executable file. Mostly useful for development. run will only execute packages whose package name is main.

To demonstrate, we will use a simple Hello World example main.go:

package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")
}

Execute without compiling to a file: go run main.go

Run multiple files in package

If the program is split into multiple files, pass those files, or run the whole package with go run .:

$ go run main.go assets.go

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents