Bootstrap

To create an application requires a simple bootstrap which contains the core Service's that are required to run the application.

For example, this site is generated with a microkernel based application and it uses a bootstrap similar to the following:

 1package main
 2
 3import (
 4  "github.com/peter-mount/documentation/tools/hugo"
 5  "github.com/peter-mount/documentation/tools/pdf"
 6  "github.com/peter-mount/go-kernel"
 7  "log"
 8)
 9
10func main() {
11  err := kernel.Launch(
12    &hugo.Hugo{},
13    &pdf.PDF{},
14  )
15  if err != nil {
16    log.Fatal(err)
17  }
18}

Here it defines two services which must be started. Each one is declared by passing an empty instance of the required Service's to the Launch method. The kernel will then deploy each one.

The order they are listed here will be used to determine which one starts first, although this can be affected by any dependencies on services that have already been deployed.


Last modified October 15, 2021: Switch print page breaks to css (d15ab85)