Targets · Go · Entry point

Entry point

Starting a program from main with its drivers.

Contents

How a Program becomes Go, in parts. Start with the introduction, then follow each part into the rendered output and the runtime it links against.

Started from main

A Go program starts from main. It registers the drivers it uses, builds the reactive program from the root component, and runs the loop until the program ends.

func main() {
  Program.Application(func() {
    Counter()
  }, []Program.Driver{
    Console.Driver(),
  })
}

Go has no browser DOM, so it suits back-end services and command-line tools; the interface driver renders to a terminal. Otherwise the model is exactly the JavaScript entry point — a root component, a driver list, and a loop that turns only when a value is written.